Skip to content

Commit 4280ee7

Browse files
author
Marcus Linke
committed
Use expectExceptions in test annotation
1 parent 3a33182 commit 4280ee7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/test/java/com/github/dockerjava/netty/exec/AuthCmdExecTest.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,8 @@ public void testAuth() throws Exception {
4444
assertEquals(response.getStatus(), "Login Succeeded");
4545
}
4646

47-
@Test()
47+
@Test(expectedExceptions = UnauthorizedException.class)
4848
public void testAuthInvalid() throws Exception {
49-
50-
try {
51-
DockerClientBuilder.getInstance(config("garbage")).build().authCmd().exec();
52-
fail("Expected a UnauthorizedException caused by a bad password.");
53-
} catch (UnauthorizedException e) {
54-
assertEquals(e.getMessage(), "Wrong login/password, please try again\n");
55-
}
49+
DockerClientBuilder.getInstance(config("garbage")).build().authCmd().exec();
5650
}
5751
}

0 commit comments

Comments
 (0)