1
2
3
4
5 package com.jcabi.http.request;
6
7 import com.jcabi.http.Request;
8 import com.jcabi.immutable.Array;
9 import java.net.HttpURLConnection;
10 import java.util.Map;
11 import org.junit.jupiter.api.Assertions;
12 import org.junit.jupiter.api.Test;
13 import org.mockito.Mockito;
14
15
16
17
18
19 final class DefaultResponseTest {
20
21
22
23
24 @Test
25 void throwsWhenEntityIsNotAUnicodeString() {
26 Assertions.assertThrows(
27 RuntimeException.class,
28 () -> new DefaultResponse(
29 Mockito.mock(Request.class),
30 HttpURLConnection.HTTP_OK,
31 "some text",
32 new Array<Map.Entry<String, String>>(),
33
34 new byte[]{(byte) 0xC0, (byte) 0xC0}
35 ).body()
36 );
37 }
38
39 }