aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-03-29 16:21:42 +0300
committerGravatar Vitaly Takmazov2019-03-29 16:21:42 +0300
commit1ae03ea2f7866b30796d7f8ae925c53d7d98c1b3 (patch)
tree5afd7cd6ae015708a921c5076291dd24443b9514 /src/test/java/com
parentc2dc3c4e839805ae010cc01541f2d26631c0862e (diff)
Using @Resource where possible
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index ea99fac3..f08c49f5 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -220,6 +220,8 @@ public class ServerTests {
private Resource noteWithDocument;
@Value("classpath:2936611-57.jpg")
private Resource jpegNoJfifTiff;
+ @Value("classpath:Transparent.gif")
+ private Resource invisiblePixel;
@Inject
private KeystoreManager testKeystoreManager;
@@ -954,8 +956,7 @@ public class ServerTests {
int freefdrid = messagesService.createReply(mid, 0, freefd, "again", null);
mockMvc.perform(get(String.format("/api/thread/mark_read/%d-%d.gif?hash=%s", mid, freefdrid, ugnichHash)))
.andExpect(status().isOk())
- .andExpect(content().bytes(IOUtils.toByteArray(
- Objects.requireNonNull(getClass().getClassLoader().getResource("Transparent.gif")))));
+ .andExpect(content().bytes(IOUtils.toByteArray(invisiblePixel.getInputStream())));
assertThat(lastRead.apply(ugnich, mid), is(freefdrid));
privacyQueriesService.blacklistUser(ugnich, freefd);
int newfreefdrid = messagesService.createReply(mid, 0, freefd, "from ban", null);
@@ -1083,9 +1084,9 @@ public class ServerTests {
.andExpect(status().isBadRequest());
}
@Test
- public void attachmentSizeTests() throws URISyntaxException, IOException {
+ public void attachmentSizeTests() throws IOException {
ImageUtils imageUtils = new ImageUtils(StringUtils.EMPTY, StringUtils.EMPTY);
- Attachment attachment = imageUtils.getAttachment(new File(getClass().getClassLoader().getResource("Transparent.gif").toURI()));
+ Attachment attachment = imageUtils.getAttachment(new File(invisiblePixel.getURI()));
assertThat(attachment.getHeight(), is(1));
assertThat(attachment.getWidth(), is(1));
}