44import static java .net .HttpURLConnection .HTTP_OK ;
55import static java .net .HttpURLConnection .HTTP_UNAVAILABLE ;
66import static org .assertj .core .api .Assertions .assertThat ;
7- import static org .mockito .ArgumentMatchers .eq ;
87import static org .mockito .Mockito .mock ;
98import static org .mockito .Mockito .verify ;
109import static org .mockito .Mockito .when ;
@@ -33,10 +32,10 @@ void getReturns200AndJsonBodyWhenUp() throws IOException {
3332
3433 Handlers .healthHandler (JSON , () -> outcome ).handle (ex );
3534
36- verify (ex ).sendResponseHeaders (eq ( HTTP_OK ), eq (( long ) body .size () ));
35+ verify (ex ).sendResponseHeaders (HTTP_OK , ( long ) body .size ());
3736 assertThat (headers .getFirst ("Content-Type" )).isEqualTo ("application/json" );
38- assertThat (body . toString () )
39- .isEqualTo ("{\" outcome\" :\" Up\" ,\" dependencies\" :[{\" id\" :\" jdbc\" ,\" status\" :\" Up\" }]}" );
37+ assertThat (body )
38+ .hasToString ("{\" outcome\" :\" Up\" ,\" dependencies\" :[{\" id\" :\" jdbc\" ,\" status\" :\" Up\" }]}" );
4039 }
4140
4241 @ Test
@@ -49,8 +48,8 @@ void getReturns200WithEmptyDependencyArrayWhenNoDeps() throws IOException {
4948
5049 Handlers .healthHandler (JSON , () -> new HealthOutcome (true , List .of ())).handle (ex );
5150
52- verify (ex ).sendResponseHeaders (eq ( HTTP_OK ), eq (( long ) body .size () ));
53- assertThat (body . toString ()). isEqualTo ("{\" outcome\" :\" Up\" ,\" dependencies\" :[]}" );
51+ verify (ex ).sendResponseHeaders (HTTP_OK , ( long ) body .size ());
52+ assertThat (body ). hasToString ("{\" outcome\" :\" Up\" ,\" dependencies\" :[]}" );
5453 }
5554
5655 @ Test
@@ -64,10 +63,10 @@ void getReturns503WhenDown() throws IOException {
6463
6564 Handlers .healthHandler (JSON , () -> outcome ).handle (ex );
6665
67- verify (ex ).sendResponseHeaders (eq ( HTTP_UNAVAILABLE ), eq (( long ) body .size () ));
66+ verify (ex ).sendResponseHeaders (HTTP_UNAVAILABLE , ( long ) body .size ());
6867 assertThat (headers .getFirst ("Content-Type" )).isEqualTo ("application/json" );
69- assertThat (body . toString () )
70- .isEqualTo (
68+ assertThat (body )
69+ .hasToString (
7170 "{\" outcome\" :\" Down\" ,\" dependencies\" :[{\" id\" :\" jdbc\" ,\" status\" :\" Down\" }]}" );
7271 }
7372
@@ -81,7 +80,7 @@ void headIsAccepted() throws IOException {
8180
8281 Handlers .healthHandler (JSON , () -> new HealthOutcome (true , List .of ())).handle (ex );
8382
84- verify (ex ).sendResponseHeaders (eq ( HTTP_OK ), eq (( long ) body .size () ));
83+ verify (ex ).sendResponseHeaders (HTTP_OK , ( long ) body .size ());
8584 }
8685
8786 @ Test
@@ -110,8 +109,8 @@ void runtimeExceptionFromProbeMapsToDown503() throws IOException {
110109 };
111110 Handlers .healthHandler (JSON , failing ).handle (ex );
112111
113- verify (ex ).sendResponseHeaders (eq ( HTTP_UNAVAILABLE ), eq (( long ) body .size () ));
114- assertThat (body . toString ()). isEqualTo ("{\" outcome\" :\" Down\" ,\" dependencies\" :[]}" );
112+ verify (ex ).sendResponseHeaders (HTTP_UNAVAILABLE , ( long ) body .size ());
113+ assertThat (body ). hasToString ("{\" outcome\" :\" Down\" ,\" dependencies\" :[]}" );
115114 }
116115
117116 @ Test
@@ -124,8 +123,8 @@ void nullReturnFromProbeMapsToDown503() throws IOException {
124123
125124 Handlers .healthHandler (JSON , () -> null ).handle (ex );
126125
127- verify (ex ).sendResponseHeaders (eq ( HTTP_UNAVAILABLE ), eq (( long ) body .size () ));
128- assertThat (body . toString ()). isEqualTo ("{\" outcome\" :\" Down\" ,\" dependencies\" :[]}" );
126+ verify (ex ).sendResponseHeaders (HTTP_UNAVAILABLE , ( long ) body .size ());
127+ assertThat (body ). hasToString ("{\" outcome\" :\" Down\" ,\" dependencies\" :[]}" );
129128 }
130129
131130 private static HttpExchange newExchange (String method ) {
0 commit comments