Skip to content

Commit b2dbc9d

Browse files
mateuszmrozewskizhendrikse
authored andcommitted
Feature/beal 642 classtoinstancemap (eugenp#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
1 parent 960e8a3 commit b2dbc9d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

guava/src/test/java/org/baeldung/guava/ClassToInstanceMapTests.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@
88

99
public class ClassToInstanceMapTests {
1010
@Test
11-
public void createEmptyImmutableMap() {
11+
public void whenOfCalled_thenCreateEmptyImmutableMap() {
1212
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.of();
1313
assertTrue(map.isEmpty());
1414
}
1515

1616
@Test
17-
public void createEmptyMutableMap() {
17+
public void whenCreateCalled_thenCreateEmptyMutableMap() {
1818
ClassToInstanceMap<Action> map = MutableClassToInstanceMap.create();
1919
assertTrue(map.isEmpty());
2020
}
2121

2222
@Test
23-
public void createSingleEntryMap() {
23+
public void whenOfWithParameterCalled_thenCreateSingleEntryMap() {
2424
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.of(Save.class, new Save());
2525
assertEquals(1, map.size());
2626
}
2727

2828
@Test
29-
public void createMapWithBuilder() {
29+
public void whenBuilderUser_thenCreateMap() {
3030
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.<Action>builder()
3131
.put(Save.class, new Save())
3232
.put(Open.class, new Open())
@@ -35,7 +35,7 @@ public void createMapWithBuilder() {
3535
}
3636

3737
@Test
38-
public void shouldReturnElement() {
38+
public void givenClassToInstanceMap_whenGetCalled_returnUpperBoundElement() {
3939
ClassToInstanceMap<Action> map = ImmutableClassToInstanceMap.of(Save.class, new Save());
4040
Action action = map.get(Save.class);
4141
assertTrue(action instanceof Save);
@@ -45,7 +45,7 @@ public void shouldReturnElement() {
4545
}
4646

4747
@Test
48-
public void shouldPutElement() {
48+
public void givenClassToInstanceMap_whenPutCalled_returnPreviousElementUpperBound() {
4949
ClassToInstanceMap<Action> map = MutableClassToInstanceMap.create();
5050
map.put(Save.class, new Save());
5151
// Put again to get previous value returned

0 commit comments

Comments
 (0)