|
11 | 11 | import org.junit.Test; |
12 | 12 | import org.junit.rules.ExpectedException; |
13 | 13 |
|
14 | | -import java.io.IOException; |
15 | | - |
16 | 14 | import static com.auth0.jwt.impl.JWTParser.getDefaultObjectMapper; |
17 | 15 | import static org.hamcrest.MatcherAssert.assertThat; |
18 | 16 | import static org.hamcrest.Matchers.*; |
19 | 17 | import static org.mockito.ArgumentMatchers.any; |
20 | | -import static org.mockito.Mockito.*; |
| 18 | +import static org.mockito.Mockito.mock; |
| 19 | +import static org.mockito.Mockito.verify; |
21 | 20 |
|
22 | 21 | public class JWTParserTest { |
23 | 22 |
|
@@ -45,19 +44,6 @@ public void shouldAddDeserializers() throws Exception { |
45 | 44 | verify(mapper).registerModule(any(Module.class)); |
46 | 45 | } |
47 | 46 |
|
48 | | - @Test |
49 | | - public void shouldThrowOnReadValueException() throws Exception { |
50 | | - String jsonPayload = "{}"; |
51 | | - exception.expect(JWTDecodeException.class); |
52 | | - exception.expectMessage(String.format("The string '%s' doesn't have a valid JSON format.", jsonPayload)); |
53 | | - |
54 | | - ObjectMapper mapper = mock(ObjectMapper.class); |
55 | | - when(mapper.readValue(eq(jsonPayload), eq(Object.class))).thenThrow(IOException.class); |
56 | | - JWTParser parser = new JWTParser(mapper); |
57 | | - |
58 | | - parser.convertFromJSON(jsonPayload, Object.class); |
59 | | - } |
60 | | - |
61 | 47 | @Test |
62 | 48 | public void shouldParsePayload() throws Exception { |
63 | 49 | ObjectMapper mapper = mock(ObjectMapper.class); |
@@ -96,7 +82,7 @@ public void shouldThrowOnInvalidHeader() throws Exception { |
96 | 82 |
|
97 | 83 | @Test |
98 | 84 | public void shouldConvertFromValidJSON() throws Exception { |
99 | | - String json = "{}"; |
| 85 | + String json = "\r\n { \r\n } \r\n"; |
100 | 86 | Object object = parser.convertFromJSON(json, Object.class); |
101 | 87 | assertThat(object, is(notNullValue())); |
102 | 88 | } |
|
0 commit comments