Feature/beal 642 classtoinstancemap (#1801)

* BAEL-642 ClassToInstanceMap example added

* BAEL-642 Improved example for ClassToInstanceMap

* Reverted change in pom.xml

* BAEL-642 Move the ClassToInstanceMap examples to guava module as unit tests

* BAEL-642 changed test names to given_when
This commit is contained in:
Mateusz Mrozewski 2017-05-07 18:32:42 +04:00 committed by Zeger Hendrikse
parent 960e8a3b44
commit b2dbc9d2b9
1 changed files with 6 additions and 6 deletions

View File

@ -8,25 +8,25 @@ import static org.junit.Assert.*;
public class ClassToInstanceMapTests {
@Test
public void createEmptyImmutableMap() {
public void whenOfCalled_thenCreateEmptyImmutableMap() {
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.of();
assertTrue(map.isEmpty());
}
@Test
public void createEmptyMutableMap() {
public void whenCreateCalled_thenCreateEmptyMutableMap() {
ClassToInstanceMap<Action> map = MutableClassToInstanceMap.create();
assertTrue(map.isEmpty());
}
@Test
public void createSingleEntryMap() {
public void whenOfWithParameterCalled_thenCreateSingleEntryMap() {
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.of(Save.class, new Save());
assertEquals(1, map.size());
}
@Test
public void createMapWithBuilder() {
public void whenBuilderUser_thenCreateMap() {
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.<Action>builder()
.put(Save.class, new Save())
.put(Open.class, new Open())
@ -35,7 +35,7 @@ public class ClassToInstanceMapTests {
}
@Test
public void shouldReturnElement() {
public void givenClassToInstanceMap_whenGetCalled_returnUpperBoundElement() {
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.of(Save.class, new Save());
Action action = map.get(Save.class);
assertTrue(action instanceof Save);
@ -45,7 +45,7 @@ public class ClassToInstanceMapTests {
}
@Test
public void shouldPutElement() {
public void givenClassToInstanceMap_whenPutCalled_returnPreviousElementUpperBound() {
ClassToInstanceMap<Action> map = MutableClassToInstanceMap.create();
map.put(Save.class, new Save());
// Put again to get previous value returned