From 1ca6c95dc2e0fce763eb6fb26698344dcb339d72 Mon Sep 17 00:00:00 2001 From: guyben Date: Mon, 7 Aug 2017 14:59:58 -0700 Subject: [PATCH] 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 --- .../google/registry/model/ofy/CommitLogCheckpointTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java b/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java index f5cf6c7c6..4cdf4e848 100644 --- a/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java +++ b/javatests/google/registry/model/ofy/CommitLogCheckpointTest.java @@ -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)); + } }