@Test
public void testAdd() {
MyType type1 = mock(MyType.class);
- assertFalse(config.isDirty());
Id<MyType> id1 = config.add(type1);
assertEquals(1, config.map().size());
assertTrue(config.map().get(id1) instanceof MyTypeWrapper);
assertSame(type1, ((MyTypeWrapper) config.map().get(id1)).getType());
- assertTrue(config.isDirty());
-
- config.resetDirty();
- assertFalse(config.isDirty());
// add another one.
MyType type2 = mock(MyType.class);
assertNotNull(id2);
assertEquals(2, config.map().size());
assertFalse(id1.equals(id2));
- assertTrue(config.isDirty());
-
}
@Test
assertNotNull(id1);
assertEquals(1, config.map().size());
- config.resetDirty();
- assertFalse(config.isDirty());
-
config.remove(id1);
assertTrue(config.map().isEmpty());
- assertTrue(config.isDirty());
}
@Test(expected = UnsupportedOperationException.class)