Skip to content

Commit 9684b96

Browse files
authored
Merge pull request #1214 from hugares/remove-junit-deprecated
Remove usage of JUnit deprecated methods
2 parents bed7132 + 69ba7f3 commit 9684b96

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/test/java/com/github/dockerjava/api/model/DeviceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
import java.util.List;
99
import java.util.Map;
1010

11-
import static junit.framework.Assert.fail;
1211
import static org.hamcrest.MatcherAssert.assertThat;
1312
import static org.hamcrest.Matchers.containsString;
1413
import static org.hamcrest.Matchers.equalTo;
14+
import static org.junit.Assert.fail;
1515

1616
/**
1717
* @author Kanstantsin Shautsou

src/test/java/com/github/dockerjava/api/model/PortsAddBindingsTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
import java.util.Map;
88

9+
import static org.junit.Assert.assertArrayEquals;
910
import static org.junit.Assert.assertEquals;
11+
import static org.junit.Assert.assertNull;
1012

1113
/**
1214
* As there may be several {@link Binding}s per {@link ExposedPort}, it makes a difference if you add {@link PortBinding}s for the same or
@@ -35,8 +37,8 @@ public void addTwoBindingsForDifferentExposedPorts() {
3537
Map<ExposedPort, Binding[]> bindings = ports.getBindings();
3638
// two keys with one value each
3739
assertEquals(bindings.size(), 2);
38-
assertEquals(bindings.get(TCP_80), new Binding[] {BINDING_8080});
39-
assertEquals(bindings.get(TCP_90), new Binding[] {BINDING_9090});
40+
assertArrayEquals(bindings.get(TCP_80), new Binding[] {BINDING_8080});
41+
assertArrayEquals(bindings.get(TCP_90), new Binding[] {BINDING_9090});
4042
}
4143

4244
@Test
@@ -46,7 +48,7 @@ public void addTwoBindingsForSameExposedPort() {
4648
Map<ExposedPort, Binding[]> bindings = ports.getBindings();
4749
// one key with two values
4850
assertEquals(bindings.size(), 1);
49-
assertEquals(bindings.get(TCP_80), new Binding[] {BINDING_8080, BINDING_9090});
51+
assertArrayEquals(bindings.get(TCP_80), new Binding[] {BINDING_8080, BINDING_9090});
5052
}
5153

5254
@Test
@@ -55,6 +57,6 @@ public void addNullBindings() {
5557
Map<ExposedPort, Binding[]> bindings = ports.getBindings();
5658
// one key with two values
5759
assertEquals(bindings.size(), 1);
58-
assertEquals(bindings.get(TCP_80), null);
60+
assertNull(bindings.get(TCP_80));
5961
}
6062
}

src/test/java/com/github/dockerjava/api/model/PortsSerializingTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.Map;
88

99
import static org.junit.Assert.assertEquals;
10+
import static org.junit.Assert.assertNull;
1011

1112
public class PortsSerializingTest {
1213
private final ObjectMapper objectMapper = new ObjectMapper();
@@ -47,7 +48,7 @@ public void deserializingPortWithNullBindings() throws Exception {
4748
Map<ExposedPort, Binding[]> map = ports.getBindings();
4849
assertEquals(map.size(), 1);
4950

50-
assertEquals(map.get(ExposedPort.tcp(80)), null);
51+
assertNull(map.get(ExposedPort.tcp(80)));
5152
}
5253

5354
@Test

src/test/java/com/github/dockerjava/core/GoLangFileMatchTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
package com.github.dockerjava.core;
55

66
import com.github.dockerjava.core.exception.GoLangFileMatchException;
7-
import junit.framework.Assert;
87
import org.apache.commons.io.FilenameUtils;
98
import org.junit.Test;
109
import org.junit.runner.RunWith;
1110
import org.junit.runners.Parameterized;
1211

12+
import static org.junit.Assert.assertEquals;
13+
import static org.junit.Assert.fail;
14+
1315
import java.io.IOException;
1416

1517
@RunWith(Parameterized.class)
@@ -97,9 +99,9 @@ public void testMatch() throws IOException {
9799
try {
98100
Boolean matched = GoLangFileMatch.match(pattern, s);
99101
if (testCase.expectException) {
100-
Assert.fail("Expected GoFileMatchException");
102+
fail("Expected GoFileMatchException");
101103
}
102-
Assert.assertEquals(testCase.toString(), testCase.matches, matched);
104+
assertEquals(testCase.toString(), testCase.matches, matched);
103105
} catch (GoLangFileMatchException e) {
104106
if (!testCase.expectException) {
105107
throw e;

0 commit comments

Comments
 (0)