aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/server/tests
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-03-01 19:49:10 +0300
committerGravatar Vitaly Takmazov2019-03-01 19:49:10 +0300
commitece568a4bcd0ff8a2f84c974a458a2f498fd135d (patch)
tree58282836e2bc3bcc29f72630bdfba76202730909 /src/test/java/com/juick/server/tests
parentaabad2347aaf52e225541cb954e98ab509e9aa2f (diff)
Message::timestamp -> Message::created
Diffstat (limited to 'src/test/java/com/juick/server/tests')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index ad375e99..7f46968f 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -433,7 +433,7 @@ public class ServerTests {
Timestamp.class, mid).toInstant();
assertThat(rts, greaterThan(ts));
Message msg = messagesService.getReply(mid, rid);
- assertThat(rts, equalTo(msg.getTimestamp()));
+ assertThat(rts, equalTo(msg.getCreated()));
messagesService.deleteMessage(ugnich_id, mid);
}
@@ -470,7 +470,7 @@ public class ServerTests {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$[0].mid", is(msg.getMid())))
.andExpect(jsonPath("$[0].timestamp",
- is(DateFormattersHolder.getMessageFormatterInstance().format(msg.getTimestamp()))))
+ is(DateFormattersHolder.getMessageFormatterInstance().format(msg.getCreated()))))
.andExpect(jsonPath("$[0].body", is(msg.getText())))
.andExpect(jsonPath("$[0].attachment.url",
is(String.format("https://i.juick.com/p/%d.png", msg.getMid()))))
@@ -726,7 +726,7 @@ public class ServerTests {
Message msg2 = yoyoMsg.getNewMessage().get();
int mid = msg2.getMid();
Timestamp last = jdbcTemplate.queryForObject("SELECT lastmessage FROM users WHERE id=?", Timestamp.class, user.getUid());
- assertThat(last.toInstant(), equalTo(yoyoMsg.getNewMessage().get().getTimestamp()));
+ assertThat(last.toInstant(), equalTo(yoyoMsg.getNewMessage().get().getCreated()));
assertEquals("should be message", true,
commandsManager.processCommand(user, String.format("#%d", mid), emptyUri).getText().startsWith("@me"));
int readerUid = userService.createUser("dummyReader", "dummySecret");
@@ -771,7 +771,7 @@ public class ServerTests {
Message reply = messagesService.getReplies(user, mid).stream().filter(m -> m.getRid() == 3).findFirst()
.orElse(new Message());
Timestamp lastreply = jdbcTemplate.queryForObject("SELECT lastmessage FROM users WHERE id=?", Timestamp.class, user.getUid());
- assertThat(lastreply.toInstant(), equalTo(reply.getTimestamp()));
+ assertThat(lastreply.toInstant(), equalTo(reply.getCreated()));
assertEquals("should be reply to second comment", 2, reply.getReplyto());
assertThat(commandsManager.processCommand(readerUser, "#" + mid + " *yo *there", emptyUri)
.getText(), startsWith("Reply posted"));
@@ -1038,7 +1038,7 @@ public class ServerTests {
Message msg = new Message();
msg.setTags(tags);
Instant currentDate = Instant.now();
- msg.setTimestamp(currentDate);
+ msg.setCreated(currentDate);
String jsonMessage = jsonMapper.writeValueAsString(msg);
assertEquals("date should be in timestamp field", DateFormattersHolder.getMessageFormatterInstance().format(currentDate),
JsonPath.read(jsonMessage, "$.timestamp"));
@@ -1210,7 +1210,7 @@ public class ServerTests {
Message original = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class)
.getNewMessage().get();
assertThat(original.getText(), equalTo("YO"));
- assertThat(original.getUpdatedAt(), equalTo(original.getTimestamp()));
+ assertThat(original.getUpdatedAt(), equalTo(original.getCreated()));
// to have updated_at greater than ts
Thread.sleep(1000);
result = mockMvc.perform(post("/api/update").with(httpBasic(ugnichName, ugnichPassword))
@@ -1219,7 +1219,7 @@ public class ServerTests {
Message edited = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class)
.getNewMessage().get();
assertThat(edited.getText(), equalTo("PEOPLE"));
- assertThat(edited.getUpdatedAt(), greaterThan(edited.getTimestamp()));
+ assertThat(edited.getUpdatedAt(), greaterThan(edited.getCreated()));
mockMvc.perform(post("/api/update").with(httpBasic(freefdName, freefdPassword))
.param("mid", String.valueOf(original.getMid()))
.param("body", "PEOPLE")).andExpect(status().is(403));
@@ -1228,7 +1228,7 @@ public class ServerTests {
.param("body", "HEY")).andExpect(status().is2xxSuccessful()).andReturn();
CommandResult comment = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class);
assertThat(comment.getNewMessage().get().getText(), is("HEY"));
- assertThat(comment.getNewMessage().get().getUpdatedAt(), is(comment.getNewMessage().get().getTimestamp()));
+ assertThat(comment.getNewMessage().get().getUpdatedAt(), is(comment.getNewMessage().get().getCreated()));
// to have updated_at greater than ts
Thread.sleep(1000);
result = mockMvc.perform(post("/api/update").with(httpBasic(freefdName, freefdPassword))
@@ -1238,7 +1238,7 @@ public class ServerTests {
Message editedComment = jsonMapper.readValue(result.getResponse().getContentAsString(), CommandResult.class)
.getNewMessage().get();
assertThat(editedComment.getText(), is("HEY, JOE"));
- assertThat(editedComment.getUpdatedAt(), greaterThan(editedComment.getTimestamp()));
+ assertThat(editedComment.getUpdatedAt(), greaterThan(editedComment.getCreated()));
messagesService.deleteMessage(ugnich.getUid(), original.getMid());
}
@Test