Skip to content

Commit

Permalink
(jcabi#206) Migrate to Junit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Jul 10, 2020
1 parent fd2ddd7 commit 2695b05
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions src/test/java/com/jcabi/http/request/DefaultResponseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import com.jcabi.immutable.Array;
import java.net.HttpURLConnection;
import java.util.Map;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import org.mockito.Mockito;

/**
Expand All @@ -44,18 +46,25 @@ public final class DefaultResponseTest {

/**
* DefaultResponse can throw when entity is not a Unicode text.
* @throws Exception If something goes wrong inside
*/
@Test(expected = RuntimeException.class)
public void throwsWhenEntityIsNotAUnicodeString() throws Exception {
new DefaultResponse(
Mockito.mock(Request.class),
HttpURLConnection.HTTP_OK,
"some text",
new Array<Map.Entry<String, String>>(),
// @checkstyle MagicNumber (1 line)
new byte[]{(byte) 0xC0, (byte) 0xC0}
).body();
@Test
public void throwsWhenEntityIsNotAUnicodeString() {
Assertions.assertThrows(
RuntimeException.class,
new Executable() {
@Override
public void execute() {
new DefaultResponse(
Mockito.mock(Request.class),
HttpURLConnection.HTTP_OK,
"some text",
new Array<Map.Entry<String, String>>(),
// @checkstyle MagicNumber (1 line)
new byte[]{(byte) 0xC0, (byte) 0xC0}
).body();
}
}
);
}

}

0 comments on commit 2695b05

Please sign in to comment.