Skip to content

Commit c5628d4

Browse files
valfirstmykola-mokhnach
authored andcommitted
Migrate to Hamcrest 2.1 (#1099)
1 parent 402f3d8 commit c5628d4

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ dependencies {
7777
compile 'org.slf4j:slf4j-api:1.7.25'
7878

7979
testCompile 'junit:junit:4.12'
80-
testCompile 'org.hamcrest:hamcrest-library:1.3'
80+
testCompile 'org.hamcrest:hamcrest:2.1'
8181
testCompile (group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '3.2.0') {
8282
exclude group: 'org.seleniumhq.selenium'
8383
}

src/test/java/io/appium/java_client/android/AndroidScreenRecordTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package io.appium.java_client.android;
22

33
import static org.hamcrest.MatcherAssert.assertThat;
4-
import static org.hamcrest.Matchers.isEmptyString;
4+
import static org.hamcrest.Matchers.emptyString;
5+
import static org.hamcrest.Matchers.is;
56
import static org.hamcrest.Matchers.not;
67

78
import org.junit.Before;
@@ -33,7 +34,7 @@ public void verifyBasicScreenRecordingWorks() throws InterruptedException {
3334
}
3435
Thread.sleep(5000);
3536
String result = driver.stopRecordingScreen();
36-
assertThat(result, not(isEmptyString()));
37+
assertThat(result, is(not(emptyString())));
3738
}
3839

3940
}

src/test/java/io/appium/java_client/events/ExtendedEventListenerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.appium.java_client.events;
22

3-
import static org.hamcrest.core.IsCollectionContaining.hasItems;
3+
import static org.hamcrest.core.IsIterableContaining.hasItems;
44
import static org.junit.Assert.assertThat;
55

66
import io.appium.java_client.MobileBy;

src/test/java/io/appium/java_client/events/WebDriverEventListenerCompatibilityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import static org.hamcrest.Matchers.contains;
44
import static org.hamcrest.core.Is.is;
5-
import static org.hamcrest.core.IsCollectionContaining.hasItems;
5+
import static org.hamcrest.core.IsIterableContaining.hasItems;
66
import static org.junit.Assert.assertThat;
77
import static org.openqa.selenium.By.id;
88
import static org.openqa.selenium.By.xpath;

src/test/java/io/appium/java_client/ios/IOSScreenRecordTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package io.appium.java_client.ios;
22

33
import static org.hamcrest.MatcherAssert.assertThat;
4-
import static org.hamcrest.Matchers.isEmptyString;
4+
import static org.hamcrest.Matchers.emptyString;
5+
import static org.hamcrest.Matchers.is;
56
import static org.hamcrest.Matchers.not;
67

78
import org.junit.Test;
@@ -18,7 +19,7 @@ public void verifyBasicScreenRecordingWorks() throws InterruptedException {
1819
);
1920
Thread.sleep(5000);
2021
String result = driver.stopRecordingScreen();
21-
assertThat(result, not(isEmptyString()));
22+
assertThat(result, is(not(emptyString())));
2223
}
2324

2425
}

src/test/java/io/appium/java_client/touch/TouchOptionsTests.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
import static junit.framework.TestCase.fail;
1212
import static org.hamcrest.CoreMatchers.everyItem;
1313
import static org.hamcrest.MatcherAssert.assertThat;
14-
import static org.hamcrest.Matchers.isIn;
14+
import static org.hamcrest.Matchers.in;
15+
import static org.hamcrest.Matchers.is;
1516

1617
import io.appium.java_client.touch.offset.ElementOption;
1718
import io.appium.java_client.touch.offset.PointOption;
@@ -65,8 +66,8 @@ public void longPressOptionsShouldBuildProperly() {
6566
expectedOpts.put("x", 0);
6667
expectedOpts.put("y", 0);
6768
expectedOpts.put("duration", 1L);
68-
assertThat(actualOpts.entrySet(), everyItem(isIn(expectedOpts.entrySet())));
69-
assertThat(expectedOpts.entrySet(), everyItem(isIn(actualOpts.entrySet())));
69+
assertThat(actualOpts.entrySet(), everyItem(is(in(expectedOpts.entrySet()))));
70+
assertThat(expectedOpts.entrySet(), everyItem(is(in(actualOpts.entrySet()))));
7071
}
7172

7273
@Test
@@ -79,8 +80,8 @@ public void tapOptionsShouldBuildProperly() {
7980
expectedOpts.put("x", 0);
8081
expectedOpts.put("y", 0);
8182
expectedOpts.put("count", 2);
82-
assertThat(actualOpts.entrySet(), everyItem(isIn(expectedOpts.entrySet())));
83-
assertThat(expectedOpts.entrySet(), everyItem(isIn(actualOpts.entrySet())));
83+
assertThat(actualOpts.entrySet(), everyItem(is(in(expectedOpts.entrySet()))));
84+
assertThat(expectedOpts.entrySet(), everyItem(is(in(actualOpts.entrySet()))));
8485
}
8586

8687
@Test
@@ -90,7 +91,7 @@ public void waitOptionsShouldBuildProperly() {
9091
.build();
9192
final Map<String, Object> expectedOpts = new HashMap<>();
9293
expectedOpts.put("ms", 1000L);
93-
assertThat(actualOpts.entrySet(), everyItem(isIn(expectedOpts.entrySet())));
94-
assertThat(expectedOpts.entrySet(), everyItem(isIn(actualOpts.entrySet())));
94+
assertThat(actualOpts.entrySet(), everyItem(is(in(expectedOpts.entrySet()))));
95+
assertThat(expectedOpts.entrySet(), everyItem(is(in(actualOpts.entrySet()))));
9596
}
9697
}

0 commit comments

Comments
 (0)