Skip to content

Commit b0565a2

Browse files
committed
Mkae minor amendments to make tests pass
1 parent 8f929a7 commit b0565a2

1 file changed

Lines changed: 20 additions & 29 deletions

File tree

‎guava/src/test/java/org/baeldung/hamcrest/HamcrestMatcherTest.java‎

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package org.baeldung.hamcrest;
22

3+
import org.junit.Test;
4+
5+
import java.util.*;
6+
37
import static org.baeldung.hamcrest.IsPositiveInteger.isAPositiveInteger;
48
import static org.hamcrest.MatcherAssert.assertThat;
5-
import static org.hamcrest.Matchers.equalTo;
6-
import static org.hamcrest.Matchers.greaterThan;
7-
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
8-
import static org.hamcrest.Matchers.lessThan;
9-
import static org.hamcrest.Matchers.lessThanOrEqualTo;
10-
import static org.hamcrest.Matchers.closeTo;
9+
import static org.hamcrest.Matchers.*;
1110
import static org.hamcrest.beans.HasProperty.hasProperty;
1211
import static org.hamcrest.beans.HasPropertyWithValue.hasProperty;
1312
import static org.hamcrest.beans.SamePropertyValuesAs.samePropertyValuesAs;
@@ -19,37 +18,29 @@
1918
import static org.hamcrest.collection.IsEmptyCollection.empty;
2019
import static org.hamcrest.collection.IsIn.isIn;
2120
import static org.hamcrest.collection.IsIn.isOneOf;
22-
import static org.hamcrest.collection.IsMapContaining.hasKey;
23-
import static org.hamcrest.collection.IsMapContaining.hasEntry;
24-
import static org.hamcrest.collection.IsMapContaining.hasValue;
2521
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
2622
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
27-
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
28-
import static org.hamcrest.text.IsEmptyString.isEmptyOrNullString;
29-
import static org.hamcrest.text.IsEmptyString.isEmptyString;
30-
import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace;
31-
import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder;
32-
import static org.hamcrest.object.HasToString.hasToString;
33-
import static org.hamcrest.object.IsCompatibleType.typeCompatibleWith;
23+
import static org.hamcrest.collection.IsMapContaining.hasEntry;
24+
import static org.hamcrest.collection.IsMapContaining.hasKey;
25+
import static org.hamcrest.collection.IsMapContaining.hasValue;
3426
import static org.hamcrest.core.AllOf.allOf;
3527
import static org.hamcrest.core.AnyOf.anyOf;
3628
import static org.hamcrest.core.Every.everyItem;
37-
import static org.hamcrest.core.Is.is;//class
29+
import static org.hamcrest.core.Is.is;
3830
import static org.hamcrest.core.IsInstanceOf.instanceOf;
39-
import static org.hamcrest.core.IsNot.not;//matcher
40-
import static org.hamcrest.core.IsNull.notNullValue;//without arg
31+
import static org.hamcrest.core.IsNot.not;
32+
import static org.hamcrest.core.IsNull.notNullValue;
4133
import static org.hamcrest.core.IsSame.sameInstance;
4234
import static org.hamcrest.core.StringContains.containsString;
4335
import static org.hamcrest.core.StringEndsWith.endsWith;
4436
import static org.hamcrest.core.StringStartsWith.startsWith;
45-
46-
import java.util.ArrayList;
47-
import java.util.Arrays;
48-
import java.util.HashMap;
49-
import java.util.List;
50-
import java.util.Map;
51-
52-
import org.junit.Test;
37+
import static org.hamcrest.object.HasToString.hasToString;
38+
import static org.hamcrest.object.IsCompatibleType.typeCompatibleWith;
39+
import static org.hamcrest.text.IsEmptyString.isEmptyOrNullString;
40+
import static org.hamcrest.text.IsEmptyString.isEmptyString;
41+
import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
42+
import static org.hamcrest.text.IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace;
43+
import static org.hamcrest.text.StringContainsInOrder.stringContainsInOrder;
5344

5445
public class HamcrestMatcherTest {
5546
@Test
@@ -150,7 +141,7 @@ public void givenCollection_whenEmpty_thenCorrect() {
150141
public void givenValueAndArray_whenValueFoundInArray_thenCorrect() {
151142
String[] array = new String[] { "collections", "beans", "text",
152143
"number" };
153-
assertThat("bean", isIn(array));
144+
assertThat("beans", isIn(array));
154145

155146
}
156147

@@ -299,7 +290,7 @@ public void givenString_whenMeetsAnyOfGivenConditions_thenCorrect() {
299290
public void givenString_whenMeetsAllOfGivenConditions_thenCorrect() {
300291
String str = "calligraphy";
301292
String start = "call";
302-
String end = "foo";
293+
String end = "phy";
303294
assertThat(str, allOf(startsWith(start), endsWith(end)));
304295
}
305296

0 commit comments

Comments
 (0)