-
Notifications
You must be signed in to change notification settings - Fork 8
/
GoodLibraryTest.java
40 lines (33 loc) · 1.11 KB
/
GoodLibraryTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Copyright (c) 2018
*/
package structure.multiple_asserts;
import org.junit.Test;
import sample.Good;
import sample.NotSoGood;
import java.util.List;
import java.util.Map;
import static com.google.common.collect.ImmutableMap.of;
import static java.util.Arrays.asList;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
public class GoodLibraryTest {
static final Map<String, List<String>> REFERENCE_CONTENTS = of(
"foo", asList("foo1", "foo2"),
"bar", asList("bar1", "bar2")
);
Library library = new Library();
@NotSoGood
@Test public void everyEntry_asExpected() {
Map<String, List<String>> map = library.contents();
assertThat(map.keySet(), containsInAnyOrder("foo", "bar"));
assertThat(map, allOf(
hasEntry(is("foo"), contains("foo1", "foo2")),
hasEntry(is("bar"), contains("bar1", "bar2"))));
}
@Good
@Test public void result_asExpected() {
Map<String, List<String>> contents = library.contents();
assertThat(contents, equalTo(REFERENCE_CONTENTS));
}
}