Add test for wrong bucketId order in CommitLogCheckpoint.create

Added to make it clear that the order of the keys in the map is important. A
better solution would be, of course, to make the order unimportant.

This can be done by using ImmutableSortedMap either as input or with copyOf
the input. But the create function is only used once, so it doesn't seem worth the effort - as long as we make sure to throw an error if the order is wrong.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164515959
This commit is contained in:
guyben 2017-08-07 14:59:58 -07:00 committed by Ben McIlwain
parent e786c8d6ff
commit 1ca6c95dc2

View file

@ -75,4 +75,10 @@ public class CommitLogCheckpointTest {
thrown.expect(IllegalArgumentException.class, "Bucket ids are incorrect");
CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(0, T1, 1, T2, 2, T3));
}
@Test
public void test_create_wrongBucketIdOrder_throws() {
thrown.expect(IllegalArgumentException.class, "Bucket ids are incorrect");
CommitLogCheckpoint.create(DateTime.now(UTC), ImmutableMap.of(2, T2, 1, T1, 3, T3));
}
}