File tree Expand file tree Collapse file tree
junit4/src/test/java/org/commonjava/test/http/junt4
junit5/src/test/java/org/commonjava/test/http/junit5
quarkus/src/test/java/org/commonjava/test/http/quarkus Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929
3030import java .io .IOException ;
3131import java .io .InputStream ;
32+ import java .nio .charset .StandardCharsets ;
3233
3334import static org .hamcrest .CoreMatchers .equalTo ;
3435import static org .hamcrest .CoreMatchers .notNullValue ;
35- import static org .junit . Assert .assertThat ;
36+ import static org .hamcrest . MatcherAssert .assertThat ;
3637
3738public class TestHttpServerTest
3839{
@@ -94,7 +95,7 @@ private String getHttpContent(String url) throws IOException
9495 try (CloseableHttpResponse response = client .execute ( request ))
9596 {
9697 InputStream stream = response .getEntity ().getContent ();
97- return IOUtils .toString ( stream );
98+ return IOUtils .toString ( stream , StandardCharsets . UTF_8 );
9899 }
99100 finally
100101 {
Original file line number Diff line number Diff line change 2626import org .junit .jupiter .api .Test ;
2727
2828import java .io .InputStream ;
29+ import java .nio .charset .StandardCharsets ;
2930
3031import static org .hamcrest .CoreMatchers .equalTo ;
3132import static org .hamcrest .CoreMatchers .is ;
@@ -91,7 +92,7 @@ public void simpleDownload()
9192 {
9293 response = client .execute ( request );
9394 stream = response .getEntity ().getContent ();
94- final String result = IOUtils .toString ( stream );
95+ final String result = IOUtils .toString ( stream , StandardCharsets . UTF_8 );
9596
9697 assertThat ( result , notNullValue () );
9798 assertThat ( result , equalTo ( content ) );
Original file line number Diff line number Diff line change 2727import org .junit .jupiter .api .Test ;
2828
2929import java .io .InputStream ;
30+ import java .nio .charset .StandardCharsets ;
3031
3132import static org .hamcrest .CoreMatchers .equalTo ;
3233import static org .hamcrest .CoreMatchers .is ;
@@ -94,7 +95,7 @@ public void simpleDownload()
9495 {
9596 response = client .execute ( request );
9697 stream = response .getEntity ().getContent ();
97- final String result = IOUtils .toString ( stream );
98+ final String result = IOUtils .toString ( stream , StandardCharsets . UTF_8 );
9899
99100 assertThat ( result , notNullValue () );
100101 assertThat ( result , equalTo ( content ) );
You can’t perform that action at this time.
0 commit comments