Skip to content

Commit 26cd13c

Browse files
authored
Fix parameter order in assertEquals (docker-java#2066)
Signed-off-by: Harald Albers <github@albersweb.de> Fixes docker-java#1923
1 parent f8fd492 commit 26cd13c

File tree

65 files changed

+223
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+223
-236
lines changed

docker-java/src/test/java/com/github/dockerjava/api/ModelsSerializableTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.github.dockerjava.api.model.ResponseItem;
1010
import com.google.common.reflect.ClassPath.ClassInfo;
1111
import org.apache.commons.lang3.reflect.FieldUtils;
12-
import org.hamcrest.MatcherAssert;
1312
import org.junit.Test;
1413
import org.slf4j.Logger;
1514
import org.slf4j.LoggerFactory;

docker-java/src/test/java/com/github/dockerjava/api/command/InspectContainerResponseTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public void roundTrip_full() throws IOException {
5656
final InspectContainerResponse response = responses[0];
5757

5858
// Check volumes: https://github.com/docker-java/docker-java/issues/211
59-
assertEquals(response.getVolumes().length, 2);
60-
assertEquals(response.getVolumesRW().length, 2);
61-
assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2");
62-
assertEquals(response.getVolumes()[1].getHostPath(), "/path2");
63-
assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2");
59+
assertEquals(2, response.getVolumes().length);
60+
assertEquals(2, response.getVolumesRW().length);
61+
assertEquals("/bar/foo/myvol2" ,response.getVolumes()[1].getContainerPath());
62+
assertEquals("/path2", response.getVolumes()[1].getHostPath());
63+
assertEquals("/bar/foo/myvol2", response.getVolumesRW()[1].getVolume().getPath());
6464
assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean());
6565
assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean());
6666
assertThat(response.getLogPath(), is("/mnt/sda1/var/lib/docker/containers/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1-json.log"));
@@ -76,11 +76,11 @@ public void roundTrip_full_healthcheck() throws IOException {
7676
type
7777
);
7878

79-
assertEquals(response.getState().getHealth().getStatus(), "healthy");
80-
assertEquals(response.getState().getHealth().getFailingStreak(), new Integer(0));
81-
assertEquals(response.getState().getHealth().getLog().size(), 2);
82-
assertEquals(response.getState().getHealth().getLog().get(0).getOutput(), "Hello");
83-
assertEquals(response.getState().getHealth().getLog().get(1).getOutput(), "World");
79+
assertEquals("healthy", response.getState().getHealth().getStatus());
80+
assertEquals(new Integer(0), response.getState().getHealth().getFailingStreak());
81+
assertEquals(2, response.getState().getHealth().getLog().size());
82+
assertEquals("Hello", response.getState().getHealth().getLog().get(0).getOutput());
83+
assertEquals("World", response.getState().getHealth().getLog().get(1).getOutput());
8484
}
8585

8686
@Test
@@ -108,11 +108,11 @@ public void roundTrip_1_26a_full() throws IOException {
108108
final InspectContainerResponse response = responses[0];
109109

110110
final List<InspectContainerResponse.Mount> mounts = response.getMounts();
111-
assertEquals(mounts.size(), 1);
111+
assertEquals(1, mounts.size());
112112

113113
final InspectContainerResponse.Mount mount = mounts.get(0);
114114
final Volume volume = mount.getDestination();
115-
assertEquals(volume.getPath(), "/var/lib/postgresql/data");
115+
assertEquals("/var/lib/postgresql/data", volume.getPath());
116116
}
117117

118118
@Test
@@ -124,11 +124,11 @@ public void roundTrip_1_26b_full() throws IOException {
124124
final InspectContainerResponse response = responses[0];
125125

126126
final List<InspectContainerResponse.Mount> mounts = response.getMounts();
127-
assertEquals(mounts.size(), 1);
127+
assertEquals(1, mounts.size());
128128

129129
final InspectContainerResponse.Mount mount = mounts.get(0);
130130
final Volume volume = mount.getDestination();
131-
assertEquals(volume.getPath(), "/srv/test");
131+
assertEquals("/srv/test", volume.getPath());
132132
}
133133

134134
@Test

docker-java/src/test/java/com/github/dockerjava/api/model/AccessModeTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ public class AccessModeTest {
1515

1616
@Test
1717
public void defaultAccessMode() {
18-
assertEquals(AccessMode.DEFAULT, rw);
18+
assertEquals(rw, AccessMode.DEFAULT);
1919
}
2020

2121
@Test
2222
public void stringify() {
23-
assertEquals(AccessMode.rw.toString(), "rw");
23+
assertEquals("rw", AccessMode.rw.toString());
2424
}
2525

2626
@Test
2727
public void fromString() {
28-
assertEquals(AccessMode.valueOf("rw"), rw);
28+
assertEquals(rw, AccessMode.valueOf("rw"));
2929
}
3030

3131
@Test

docker-java/src/test/java/com/github/dockerjava/api/model/AuthConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
public class AuthConfigTest {
1818

1919
@Test
20-
public void defaultServerAddress() throws Exception {
20+
public void defaultServerAddress() {
2121
assertEquals(new AuthConfig().getRegistryAddress(), "https://index.docker.io/v1/");
2222
}
2323

docker-java/src/test/java/com/github/dockerjava/api/model/CapabilityTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ public class CapabilityTest {
1111
@Test
1212
public void serializeCapability() throws Exception {
1313
String json = JSONTestHelper.getMapper().writeValueAsString(Capability.ALL);
14-
assertEquals(json, "\"ALL\"");
14+
assertEquals("\"ALL\"", json);
1515
}
1616

1717
@Test
1818
public void deserializeCapability() throws Exception {
1919
Capability capability = JSONTestHelper.getMapper().readValue("\"ALL\"", Capability.class);
20-
assertEquals(capability, Capability.ALL);
20+
assertEquals(Capability.ALL, capability);
2121
}
2222

2323
@Test(expected = JsonMappingException.class)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class DeviceTest {
5454
}};
5555

5656
@Test
57-
public void testParse() throws Exception {
57+
public void testParse() {
5858
assertThat(Device.parse("/dev/sda:/dev/xvdc:r"),
5959
equalTo(new Device("r", "/dev/xvdc", "/dev/sda")));
6060

docker-java/src/test/java/com/github/dockerjava/api/model/ExposedPortTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ public class ExposedPortTest {
1616
@Test
1717
public void parsePortAndProtocol() {
1818
ExposedPort exposedPort = ExposedPort.parse("80/tcp");
19-
assertEquals(exposedPort, new ExposedPort(80, TCP));
19+
assertEquals(new ExposedPort(80, TCP), exposedPort);
2020
}
2121

2222
@Test
2323
public void parsePortOnly() {
2424
ExposedPort exposedPort = ExposedPort.parse("80");
25-
assertEquals(exposedPort, new ExposedPort(80, DEFAULT));
25+
assertEquals(new ExposedPort(80, DEFAULT), exposedPort);
2626
}
2727

2828
@Test
@@ -43,7 +43,7 @@ public void parseNull() {
4343

4444
@Test
4545
public void stringify() {
46-
assertEquals(ExposedPort.parse("80/tcp").toString(), "80/tcp");
46+
assertEquals("80/tcp", ExposedPort.parse("80/tcp").toString());
4747
}
4848

4949
}

docker-java/src/test/java/com/github/dockerjava/api/model/ExposedPortsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void usesFromJson() throws Exception {
5151
}
5252

5353
@Test
54-
public void usesFromJsonWithDuplicate() throws Exception {
54+
public void usesFromJsonWithDuplicate() {
5555
ExposedPorts ports = new ExposedPorts(
5656
new ExposedPort(80, InternetProtocol.UDP),
5757
new ExposedPort(80),

docker-java/src/test/java/com/github/dockerjava/api/model/HostConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class HostConfigTest {
99

1010
@Test
11-
public void testNewObjectsEqual() throws Exception {
11+
public void testNewObjectsEqual() {
1212
assertThat(HostConfig.newHostConfig(),
1313
equalTo(HostConfig.newHostConfig()));
1414
}

docker-java/src/test/java/com/github/dockerjava/api/model/IdentifierTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ public void testFromCompoundString() throws Exception {
1717
Identifier i3A = Identifier.fromCompoundString("10.0.0.1:123/jim:latest");
1818

1919
assertTrue(!i1.tag.isPresent());
20-
assertEquals(i1.repository.name, "10.0.0.1/jim");
20+
assertEquals("10.0.0.1/jim", i1.repository.name);
2121

2222
assertTrue(i2.tag.isPresent());
23-
assertEquals(i2.tag.get(), "123");
24-
assertEquals(i2.repository.name, "10.0.0.1/jim");
23+
assertEquals("123", i2.tag.get());
24+
assertEquals("10.0.0.1/jim", i2.repository.name);
2525

2626
assertTrue(i3.tag.isPresent());
27-
assertEquals(i3.tag.get(), "124");
28-
assertEquals(i3.repository.name, "10.0.0.1:123/jim");
29-
assertEquals(i3.repository.getURL().getPort(), 123);
30-
assertEquals(i3A.tag.get(), "latest");
27+
assertEquals("124", i3.tag.get());
28+
assertEquals("10.0.0.1:123/jim", i3.repository.name);
29+
assertEquals(123, i3.repository.getURL().getPort());
30+
assertEquals("latest", i3A.tag.get());
3131

3232
Identifier i4 = Identifier.fromCompoundString("centos:latest");
3333
assertTrue(i4.tag.isPresent());
34-
assertEquals(i4.tag.get(), "latest");
34+
assertEquals("latest", i4.tag.get());
3535

3636
Identifier i5 = Identifier.fromCompoundString("busybox");
3737
assertTrue(!i5.tag.isPresent());
3838

3939
Identifier i6 = Identifier.fromCompoundString("10.0.0.1:5000/my-test-image:1234");
40-
assertEquals(i6.repository.getPath(), "my-test-image");
40+
assertEquals("my-test-image", i6.repository.getPath());
4141
}
4242
}

0 commit comments

Comments
 (0)