aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-03-01 10:08:00 +0300
committerGravatar Vitaly Takmazov2019-03-01 10:08:00 +0300
commite1e416608c2ed864cb7d93fc582dd267aa5a0b5e (patch)
tree384d86aed9e3e784329fa905b551f165fc00a33f /src/test
parentb53425e6b036f6760a5d0a98537f99b8d9509d34 (diff)
ImageUtils catch IOException from apache-imaging
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java9
-rw-r--r--src/test/resources/2936611-57.jpgbin0 -> 101818 bytes
2 files changed, 9 insertions, 0 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index c8f07d06..a0d10988 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -215,6 +215,8 @@ public class ServerTests {
private Resource hubzillaFollow;
@Value("classpath:announce.json")
private Resource noteWithDocument;
+ @Value("classpath:2936611-57.jpg")
+ private Resource jpegNoJfifTiff;
@Inject
private KeystoreManager testKeystoreManager;
@@ -1177,6 +1179,13 @@ public class ServerTests {
assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getHeight(), is(1280));
assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getMedium().getHeight(), is(1024));
assertThat(postJpgiPhone.getNewMessage().get().getAttachment().getSmall().getHeight(), is(512));
+ CommandResult postNojfifTiff = commandsManager.processCommand(ugnich, "YO2", jpegNoJfifTiff.getURI());
+ assertThat(postNojfifTiff.getNewMessage().isPresent(), is(true));
+ int mid2 = postNojfifTiff.getNewMessage().get().getMid();
+ File originalFile2 = Paths.get(imgDir, "p", String.format("%d.jpg", mid2)).toFile();
+ assertThat(originalFile2.exists(), is(true));
+ File mediumFile2 = Paths.get(imgDir, "photos-1024", String.format("%d.jpg", mid2)).toFile();
+ assertThat(mediumFile2.exists(), is(true));
}
@Test
public void changeExtensionWhenReceiveFileWithWrongContentType() throws Exception {
diff --git a/src/test/resources/2936611-57.jpg b/src/test/resources/2936611-57.jpg
new file mode 100644
index 00000000..af4f9c91
--- /dev/null
+++ b/src/test/resources/2936611-57.jpg
Binary files differ