Skip to content

Commit ca8a2c3

Browse files
authored
Merge pull request #70 from dwalluck/fix-deprecated-calls
Replace deprecated `assertThat` and `IOUtils.toString()` calls
2 parents 4349aca + ab5efb3 commit ca8a2c3

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

junit4/src/test/java/org/commonjava/test/http/junt4/TestHttpServerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@
2929

3030
import java.io.IOException;
3131
import java.io.InputStream;
32+
import java.nio.charset.StandardCharsets;
3233

3334
import static org.hamcrest.CoreMatchers.equalTo;
3435
import static org.hamcrest.CoreMatchers.notNullValue;
35-
import static org.junit.Assert.assertThat;
36+
import static org.hamcrest.MatcherAssert.assertThat;
3637

3738
public 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
{

junit5/src/test/java/org/commonjava/test/http/junit5/AbstractExtensionTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.junit.jupiter.api.Test;
2727

2828
import java.io.InputStream;
29+
import java.nio.charset.StandardCharsets;
2930

3031
import static org.hamcrest.CoreMatchers.equalTo;
3132
import 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 ) );

quarkus/src/test/java/org/commonjava/test/http/quarkus/TestHttpServerWithQuarkus.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.junit.jupiter.api.Test;
2828

2929
import java.io.InputStream;
30+
import java.nio.charset.StandardCharsets;
3031

3132
import static org.hamcrest.CoreMatchers.equalTo;
3233
import 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 ) );

0 commit comments

Comments
 (0)