@Test
public void testGetNewIndexes() throws IOException {
CDefinition OldDefinition = JsonUtil.objectFromJsonResource(CDefinition.class, this.getClass().getClassLoader(), "MigrationTestCDefinition.js");
CDefinition NewDefinition = JsonUtil.objectFromJsonResource(CDefinition.class, this.getClass().getClassLoader(), "MigrationTestCDefinition.js");
CObjectMigrator subject = new CObjectMigrator(OldDefinition,NewDefinition);
//No new indexes
assertEquals(subject.getNewIndexes().size(), 0);
//1 new index
CIndex newIndex1 = new CIndex();
newIndex1.setKey("index_1:index_2");
newIndex1.setShardingStrategy(new ShardingStrategyNone());
NewDefinition.getIndexes().put(newIndex1.getName(), newIndex1);
assertEquals(subject.getNewIndexes().size(), 1);
assertEquals(subject.getNewIndexes().get(0).getKey(), newIndex1.getKey());
//2 new indexes
CIndex newIndex2 = new CIndex();
newIndex2.setKey("value");
newIndex2.setShardingStrategy(new ShardingStrategyNone());
NewDefinition.getIndexes().put(newIndex2.getName(), newIndex2);
assertEquals(subject.getNewIndexes().size(), 2);
assertEquals(subject.getNewIndexes().get(0).getKey(), newIndex2.getKey());
assertEquals(subject.getNewIndexes().get(1).getKey(), newIndex1.getKey());
}