|
|
|
@ -24,6 +24,7 @@ import org.mockito.junit.MockitoJUnitRunner; |
|
|
|
import org.springframework.core.convert.ConversionService; |
|
|
|
import org.springframework.core.convert.ConversionService; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable; |
|
|
|
import java.io.Serializable; |
|
|
|
|
|
|
|
import java.math.BigInteger; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.ResultSet; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.UUID; |
|
|
|
@ -39,6 +40,7 @@ import static org.mockito.BDDMockito.given; |
|
|
|
public class AclClassIdUtilsTest { |
|
|
|
public class AclClassIdUtilsTest { |
|
|
|
|
|
|
|
|
|
|
|
private static final Long DEFAULT_IDENTIFIER = 999L; |
|
|
|
private static final Long DEFAULT_IDENTIFIER = 999L; |
|
|
|
|
|
|
|
private static final BigInteger BIGINT_IDENTIFIER = new BigInteger("999"); |
|
|
|
private static final String DEFAULT_IDENTIFIER_AS_STRING = DEFAULT_IDENTIFIER.toString(); |
|
|
|
private static final String DEFAULT_IDENTIFIER_AS_STRING = DEFAULT_IDENTIFIER.toString(); |
|
|
|
|
|
|
|
|
|
|
|
@Mock |
|
|
|
@Mock |
|
|
|
@ -62,6 +64,15 @@ public class AclClassIdUtilsTest { |
|
|
|
assertThat(newIdentifier).isEqualTo(DEFAULT_IDENTIFIER); |
|
|
|
assertThat(newIdentifier).isEqualTo(DEFAULT_IDENTIFIER); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void shouldReturnLongIfIdentifierIsBigInteger() throws SQLException { |
|
|
|
|
|
|
|
// when
|
|
|
|
|
|
|
|
Serializable newIdentifier = aclClassIdUtils.identifierFrom(BIGINT_IDENTIFIER, resultSet); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// then
|
|
|
|
|
|
|
|
assertThat(newIdentifier).isEqualTo(DEFAULT_IDENTIFIER); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void shouldReturnLongIfClassIdTypeIsNull() throws SQLException { |
|
|
|
public void shouldReturnLongIfClassIdTypeIsNull() throws SQLException { |
|
|
|
// given
|
|
|
|
// given
|
|
|
|
|