diff options
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 64fbd030a..13f8b1f25 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -795,9 +795,8 @@ public class ServerTests { (rs, rowNum) -> ((UserServiceImpl) userService).getOffsetDateTime(rs, 1).toInstant(), user.getUid()); var last = list.get(0); assertThat(last, equalTo(yoyoMsg.getNewMessage().get().getCreated())); - assertEquals(true, - commandsManager.processCommand(user, String.format("#%d", mid), emptyUri).getText() - .startsWith("@me")); + assertTrue(commandsManager.processCommand(user, String.format("#%d", mid), emptyUri).getText() + .startsWith("@me")); User readerUser = userService.createUser("dummyReader", "dummySecret") .orElseThrow(IllegalStateException::new); assertThat( @@ -1909,7 +1908,7 @@ public class ServerTests { public void escapeSqlTests() { String sql = String.format("SELECT * FROM table WHERE data='%s'", WebUtils.encodeSphinx("';-- DROP TABLE table")); - assertThat(sql, is("SELECT * FROM table WHERE data='\\';-- DROP TABLE table\'")); + assertThat(sql, is("SELECT * FROM table WHERE data='\\';-- DROP TABLE table'")); } @Test @@ -1967,7 +1966,7 @@ public class ServerTests { Create create = jsonMapper.readValue(createJsonStr, Create.class); Note note = (Note) create.getObject(); Context attachmentObj = note.getAttachment().get(0); - String attachment = attachmentObj != null ? (String) attachmentObj.getUrl() : StringUtils.EMPTY; + String attachment = attachmentObj != null ? attachmentObj.getUrl() : StringUtils.EMPTY; String deleteJsonStr = IOUtils.toString(new ClassPathResource("delete.json").getURI(), StandardCharsets.UTF_8); Delete delete = jsonMapper.readValue(deleteJsonStr, Delete.class); @@ -2259,7 +2258,7 @@ public class ServerTests { String noteString = IOUtils.toString(noteWithAttachment.getInputStream(), StandardCharsets.UTF_8); Create create = jsonMapper.readValue(noteString, Create.class); Note note = (Note) create.getObject(); - String markdown = remarkConverter.convertFragment((String) note.getContent()); + String markdown = remarkConverter.convertFragment(note.getContent()); String commandBody = note.getContent() == null ? markdown : note.getAttachment().stream().map(attachment -> { String attachmentUrl = attachment.getUrl(); @@ -2515,8 +2514,8 @@ public class ServerTests { @Test public void ldRequestToBlogShouldRedirect() throws Exception { - var htmlUri = String.format("/ugnich/"); - var ldUri = String.format("/u/ugnich"); + var htmlUri = "/ugnich/"; + var ldUri = "/u/ugnich"; mockMvc.perform(get(htmlUri).accept(Context.LD_JSON_MEDIA_TYPE)).andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(ldUri)); mockMvc.perform(get(htmlUri).accept(MediaType.APPLICATION_JSON)).andExpect(status().is3xxRedirection()) |