aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-22 14:18:47 +0000
committerGravatar Vitaly Takmazov2019-10-22 14:18:47 +0000
commitf62db11edaa4c7420591e03a04b63cb3e3e136c2 (patch)
tree1d187ba51a081374e108d9b19ab50ab47bcc6436 /src/test/java/com/juick
parentf00be8c6d4b1d420119f9f08d400719fd62d2d39 (diff)
Revert "Spring Boot 2.2"
This reverts commit d3648888eaea9904fb3b806d56b22827c7614f54.
Diffstat (limited to 'src/test/java/com/juick')
-rw-r--r--src/test/java/com/juick/FormatterTest.java8
-rw-r--r--src/test/java/com/juick/MessageTest.java8
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java25
3 files changed, 20 insertions, 21 deletions
diff --git a/src/test/java/com/juick/FormatterTest.java b/src/test/java/com/juick/FormatterTest.java
index 8a6bf83f..da9f5d26 100644
--- a/src/test/java/com/juick/FormatterTest.java
+++ b/src/test/java/com/juick/FormatterTest.java
@@ -39,13 +39,13 @@ public class FormatterTest {
public void forAnyDateFormatterShouldReturnNotEmptyString() throws Exception {
Instant ts = Instant.now();
- assertThat(DateFormattersHolder.getMessageFormatterInstance().format(ts), not(emptyOrNullString()));
- assertThat(DateFormattersHolder.getRssFormatterInstance().format(ts), not(emptyOrNullString()));
+ assertThat(DateFormattersHolder.getMessageFormatterInstance().format(ts), not(isEmptyOrNullString()));
+ assertThat(DateFormattersHolder.getRssFormatterInstance().format(ts), not(isEmptyOrNullString()));
ts = Instant.ofEpochMilli(RandomUtils.nextLong(1, Long.MAX_VALUE / 10000));
- assertThat(DateFormattersHolder.getMessageFormatterInstance().format(ts), not(emptyOrNullString()));
- assertThat(DateFormattersHolder.getRssFormatterInstance().format(ts), not(emptyOrNullString()));
+ assertThat(DateFormattersHolder.getMessageFormatterInstance().format(ts), not(isEmptyOrNullString()));
+ assertThat(DateFormattersHolder.getRssFormatterInstance().format(ts), not(isEmptyOrNullString()));
}
@Test
diff --git a/src/test/java/com/juick/MessageTest.java b/src/test/java/com/juick/MessageTest.java
index 64d19e13..b4c5f4ab 100644
--- a/src/test/java/com/juick/MessageTest.java
+++ b/src/test/java/com/juick/MessageTest.java
@@ -129,20 +129,20 @@ public class MessageTest {
public void tagsStringShouldBeEmptyIfNoTags() {
Message message = new Message();
- assertThat(MessageUtils.getTagsString(message), is(emptyString()));
+ assertThat(MessageUtils.getTagsString(message), isEmptyString());
message.FriendsOnly = true;
- assertThat(MessageUtils.getTagsString(message), is(emptyString()));
+ assertThat(MessageUtils.getTagsString(message), isEmptyString());
message.Hidden = true;
message.ReadOnly = true;
- assertThat(MessageUtils.getTagsString(message), is(emptyString()));
+ assertThat(MessageUtils.getTagsString(message), isEmptyString());
message.setTags(MessageUtils.parseTags(" "));
- assertThat(MessageUtils.getTagsString(message), is(emptyString()));
+ assertThat(MessageUtils.getTagsString(message), isEmptyString());
}
@Test
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index e6c394d2..644ff096 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))
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.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))
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.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))
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.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))
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.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)
+ .contentType(MediaType.APPLICATION_JSON_UTF8)
.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)
+ .contentType(MediaType.APPLICATION_JSON_UTF8)
.content(jsonMapper.writeValueAsBytes(tokens))).andExpect(status().isForbidden());
mockMvc.perform(delete("/api/notifications").with(httpBasic(juickName, juickPassword))
- .contentType(MediaType.APPLICATION_JSON)
+ .contentType(MediaType.APPLICATION_JSON_UTF8)
.content(jsonMapper.writeValueAsBytes(tokens))).andExpect(status().isOk());
}
@Test
@@ -1135,8 +1135,7 @@ public class ServerTests {
.andExpect(status().isOk())
.andReturn();
List<Message> fromApi = jsonMapper.readValue(apiResult.getResponse().getContentAsString(),
- new TypeReference<>() {
- });
+ new TypeReference<List<Message>>() {});
assertThat(fromApi.get(0).getTags(), is(tags));
}
@Test
@@ -1672,7 +1671,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))
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(jsonPath("$.webcredentials.apps[0]", is(appId)));
}
@Test
@@ -1706,7 +1705,7 @@ public class ServerTests {
@Test
public void swaggerOutput() throws Exception {
MvcResult result = mockMvc.perform(get("/v2/api-docs")
- .accept(MediaType.APPLICATION_JSON))
+ .accept(MediaType.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andReturn();
String outputDir = System.getProperty("io.springfox.staticdocs.outputDir");
@@ -1835,9 +1834,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));
+ .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON_UTF8));
restServiceServer.expect(times(3), requestTo(testuserkeyUri))
- .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON));
+ .andRespond(withSuccess(testuserResponseString, MediaType.APPLICATION_JSON_UTF8));
Person testuser = (Person)signatureManager.getContext(testuserUri).get();
Assert.assertThat(testuser.getPublicKey().getPublicKeyPem(), is(testKeystoreManager.getPublicKeyPem()));
Instant now2 = Instant.now();