1515 */
1616package feign ;
1717
18- import static org .junit .jupiter .api .Assertions .assertEquals ;
19- import static org .junit .jupiter .api .Assertions .assertNotNull ;
20- import static org .junit .jupiter .api .Assertions .assertNull ;
18+ import static org .assertj .core .api .Assertions .assertThat ;
2119
2220import feign .Request .HttpMethod ;
2321import java .util .Collection ;
2422import java .util .Collections ;
2523import org .junit .jupiter .api .Test ;
2624
27- public class LoggerRebufferTest {
25+ class LoggerRebufferTest {
2826
2927 private static final String CONFIG_KEY = "TestApi#testMethod()" ;
3028
@@ -55,8 +53,10 @@ void headersLevelRebuffersResponseBody() throws Exception {
5553 // then
5654 String read1 = Util .toString (result .body ().asReader (Util .UTF_8 ));
5755 String read2 = Util .toString (result .body ().asReader (Util .UTF_8 ));
58- assertEquals (originalBody , read1 , "First read should return original body" );
59- assertEquals (originalBody , read2 , "Second read should return same body (rebuffered)" );
56+ assertThat (read1 ).as ("First read should return original body" ).isEqualTo (originalBody );
57+ assertThat (read2 )
58+ .as ("Second read should return same body (rebuffered)" )
59+ .isEqualTo (originalBody );
6060 }
6161
6262 @ Test
@@ -79,7 +79,7 @@ void basicLevelDoesNotRebufferResponseBody() throws Exception {
7979
8080 // then
8181 String read1 = Util .toString (result .body ().asReader (Util .UTF_8 ));
82- assertEquals ( originalBody , read1 , "First read should return original body" );
82+ assertThat ( read1 ). as ( "First read should return original body" ). isEqualTo ( originalBody );
8383 }
8484
8585 @ Test
@@ -104,9 +104,9 @@ void fullLevelRebuffersResponseBody() throws Exception {
104104 String read1 = Util .toString (result .body ().asReader (Util .UTF_8 ));
105105 String read2 = Util .toString (result .body ().asReader (Util .UTF_8 ));
106106 String read3 = Util .toString (result .body ().asReader (Util .UTF_8 ));
107- assertEquals ( originalBody , read1 , "First read should return original body" );
108- assertEquals ( originalBody , read2 , "Second read should return same body" );
109- assertEquals ( originalBody , read3 , "Third read should return same body" );
107+ assertThat ( read1 ). as ( "First read should return original body" ). isEqualTo ( originalBody );
108+ assertThat ( read2 ). as ( "Second read should return same body" ). isEqualTo ( originalBody );
109+ assertThat ( read3 ). as ( "Third read should return same body" ). isEqualTo ( originalBody );
110110 }
111111
112112 @ Test
@@ -129,7 +129,7 @@ void noneLevelDoesNotRebufferResponseBody() throws Exception {
129129
130130 // then
131131 String read1 = Util .toString (result .body ().asReader (Util .UTF_8 ));
132- assertEquals ( originalBody , read1 , "Body should be readable" );
132+ assertThat ( read1 ). as ( "Body should be readable" ). isEqualTo ( originalBody );
133133 }
134134
135135 @ Test
@@ -152,7 +152,7 @@ void http204DoesNotRebufferEvenAtHeadersLevel() throws Exception {
152152 logger .logAndRebufferResponse (CONFIG_KEY , Logger .Level .HEADERS , response , 100 );
153153
154154 // then
155- assertNotNull (result .body (), "Response body object should exist" );
155+ assertThat (result .body ()). as ( "Response body object should exist" ). isNotNull ( );
156156 }
157157
158158 @ Test
@@ -174,7 +174,7 @@ void http205DoesNotRebufferEvenAtHeadersLevel() throws Exception {
174174 logger .logAndRebufferResponse (CONFIG_KEY , Logger .Level .HEADERS , response , 100 );
175175
176176 // then
177- assertNotNull (result .body (), "Response body object should exist" );
177+ assertThat (result .body ()). as ( "Response body object should exist" ). isNotNull ( );
178178 }
179179
180180 @ Test
@@ -197,6 +197,6 @@ void nullBodyHandledCorrectlyAtHeadersLevel() throws Exception {
197197 logger .logAndRebufferResponse (CONFIG_KEY , Logger .Level .HEADERS , response , 100 );
198198
199199 // then
200- assertNull (result .body (), "Body should remain null" );
200+ assertThat (result .body ()). as ( "Body should remain null" ). isNull ( );
201201 }
202202}
0 commit comments