public void testMaxByteIds() throws Exception
{
getLogger().info( "testMaxByteIds" );
IdGenerator idGenerator = (IdGenerator)m_idGeneratorSelector.select( "ids-testMaxByteIds" );
try
{
int testCount = 100;
long max = Byte.MAX_VALUE;
long initial = max - testCount;
// Initialize the counter in the database.
initializeNextLongId( "test", initial );
for( int i = 0; i <= testCount; i++ )
{
byte id = idGenerator.getNextByteId();
assertEquals( "The returned id was not what was expected.", i + initial, id );
}
// Next one should throw an exception
try
{
byte id = idGenerator.getNextByteId();
fail( "Should not have gotten an id: " + id );
}
catch( IdException e )
{
// Good. Got the exception.