Skip to content

Commit

Permalink
Feature/beal 642 classtoinstancemap (eugenp#1801)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mateuszmrozewski authored and zhendrikse committed May 7, 2017
1 parent 960e8a3 commit b2dbc9d
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@

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())
Expand All @@ -35,7 +35,7 @@ public void createMapWithBuilder() {
}

@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);
Expand All @@ -45,7 +45,7 @@ public void shouldReturnElement() {
}

@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
Expand Down

0 comments on commit b2dbc9d

Please sign in to comment.