-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageGeneratorTest.java
More file actions
62 lines (42 loc) · 1.03 KB
/
ImageGeneratorTest.java
File metadata and controls
62 lines (42 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.BackEnd.tests;
import static org.junit.Assert.*;
import java.io.File;
import org.junit.Test;
import com.BackEnd.ImageGenerator;
import magick.MagickException;
public class ImageGeneratorTest {
private boolean contains(String arr[], String key )
{
boolean ret=false;
for(int i=0;i<arr.length;++i)
{
if(arr[i].equals(key)) {
ret=true;
return ret;
}
}
return ret;
}
@Test
public void testBuildCollage() {
try {
ImageGenerator.BuildCollage("dog");
} catch (MagickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
File myFiles= new File("gimages/dog");
int numFiles=myFiles.listFiles().length;
assertTrue(numFiles==31);
assertTrue(contains(myFiles.list(),"output.png"));
for(int i=1;i<31;++i)
{
assertTrue(contains(myFiles.list(),"saved"+Integer.toString(i-1)+".png"));
}
}
@Test
public void testConvertToPngFile() {
String res=ImageGenerator.ConvertToPngFile();
assertTrue(res.equals("data:image/png;base64,"));
}
}