diff options
author | Vitaly Takmazov | 2019-11-13 10:11:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2019-11-13 10:11:54 +0300 |
commit | 4fcfacbdabd96b6b319d3f5cd5e1fc47531ec275 (patch) | |
tree | 83fad5fbc41d47b50895a8be92030ececc6db617 /src/test/java/com/juick/server/tests | |
parent | fd9368dd168e73be86b2f1048adf753205953a27 (diff) |
Spring Boot 2.2.1, Babel 7.7
Diffstat (limited to 'src/test/java/com/juick/server/tests')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 644ff096..f89eca81 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -504,7 +504,7 @@ public class ServerTests { get("/api/home") .with(httpBasic(ugnichName, ugnichPassword))) .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$[0].mid", is(msg.getMid()))) .andExpect(jsonPath("$[0].timestamp", is(DateFormattersHolder.getMessageFormatterInstance().format(msg.getCreated())))) @@ -574,7 +574,7 @@ public class ServerTests { .param("uname", "ugnich") .param("uname", "freefd")) .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$", hasSize(2))); } @@ -593,7 +593,7 @@ public class ServerTests { mockMvc.perform(get("/api/messages?"+ "hash=" + userIdHash)) .andDo(print()) .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect((jsonPath("$[0].reactions[?(@.id == 3)].count", is(Collections.singletonList(1))))) .andExpect((jsonPath("$[0].reactions[?(@.id == 2)].count", @@ -601,7 +601,7 @@ public class ServerTests { mockMvc.perform(get("/api/reactions?hash=" + userIdHash)) .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.length()", is(7))); } @@ -660,7 +660,7 @@ public class ServerTests { String token = "123456"; ExternalToken registration = new ExternalToken(null, "apns", token, null); mockMvc.perform(put("/api/notifications").with(httpBasic(ugnichName, ugnichPassword)) - .contentType(MediaType.APPLICATION_JSON_UTF8) + .contentType(MediaType.APPLICATION_JSON) .content(jsonMapper.writeValueAsBytes(Collections.singletonList(registration)))) .andExpect(status().isOk()); MvcResult result = mockMvc.perform(get("/api/notifications") @@ -685,10 +685,10 @@ public class ServerTests { public void notificationsTokensTest() throws Exception { List<ExternalToken> tokens = Collections.singletonList(new ExternalToken(null, "gcm", "123456", null)); mockMvc.perform(delete("/api/notifications").with(httpBasic(ugnichName, ugnichPassword)) - .contentType(MediaType.APPLICATION_JSON_UTF8) + .contentType(MediaType.APPLICATION_JSON) .content(jsonMapper.writeValueAsBytes(tokens))).andExpect(status().isForbidden()); mockMvc.perform(delete("/api/notifications").with(httpBasic(juickName, juickPassword)) - .contentType(MediaType.APPLICATION_JSON_UTF8) + .contentType(MediaType.APPLICATION_JSON) .content(jsonMapper.writeValueAsBytes(tokens))).andExpect(status().isOk()); } @Test @@ -1134,8 +1134,9 @@ public class ServerTests { MvcResult apiResult = mockMvc.perform(get("/api/thread?mid=" + msg.getMid())) .andExpect(status().isOk()) .andReturn(); - List<Message> fromApi = jsonMapper.readValue(apiResult.getResponse().getContentAsString(), - new TypeReference<List<Message>>() {}); + List<Message> fromApi = jsonMapper.readValue(apiResult.getResponse().getContentAsString(StandardCharsets.UTF_8), + new TypeReference<>() { + }); assertThat(fromApi.get(0).getTags(), is(tags)); } @Test @@ -1671,7 +1672,7 @@ public class ServerTests { public void appAssociationsTest() throws Exception { mockMvc.perform((get("/.well-known/apple-app-site-association"))) .andExpect(status().isOk()) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.webcredentials.apps[0]", is(appId))); } @Test @@ -1705,7 +1706,7 @@ public class ServerTests { @Test public void swaggerOutput() throws Exception { MvcResult result = mockMvc.perform(get("/v2/api-docs") - .accept(MediaType.APPLICATION_JSON_UTF8)) + .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); String outputDir = System.getProperty("io.springfox.staticdocs.outputDir"); @@ -1834,9 +1835,9 @@ public class ServerTests { URI testuserkeyUri = URI.create("https://example.com/u/testuser#main-key"); MockRestServiceServer restServiceServer = MockRestServiceServer.createServer(apClient); restServiceServer.expect(times(3), requestTo(testuserUri)) - .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON_UTF8)); + .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON)); restServiceServer.expect(times(3), requestTo(testuserkeyUri)) - .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON_UTF8)); + .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON)); Person testuser = (Person)signatureManager.getContext(testuserUri).get(); Assert.assertThat(testuser.getPublicKey().getPublicKeyPem(), is(testKeystoreManager.getPublicKeyPem())); Instant now2 = Instant.now(); |