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 63 64 65 66 67 68 69 70 71
|
import org.junit.Test;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import com.gitlab.pdftk_java.pdftk;
public class StampTest extends BlackBox {
void stdin_operation(String operation) throws IOException {
byte[] expected = getPdf("test/files/blank.pdf", operation, "test/files/duck.pdf", "output", "-");
InputStream stdinMock = new FileInputStream("test/files/blank.pdf");
InputStream originalIn = System.in;
System.setIn(stdinMock);
byte[] actual = getPdf("-", operation, "test/files/duck.pdf", "output", "-");
System.setIn(originalIn);
assertPdfEqualsAsPS(expected, actual);
}
void operation_stdin(String operation) throws IOException {
byte[] expected = getPdf("test/files/blank.pdf", operation, "test/files/duck.pdf", "output", "-");
InputStream stdinMock = new FileInputStream("test/files/duck.pdf");
InputStream originalIn = System.in;
System.setIn(stdinMock);
byte[] actual = getPdf("test/files/blank.pdf", operation, "-", "output", "-");
System.setIn(originalIn);
assertPdfEqualsAsPS(expected, actual);
}
@Test
public void stdin_background() throws IOException {
stdin_operation("background");
}
@Test
public void stdin_multibackground() throws IOException {
stdin_operation("multibackground");
}
@Test
public void stdin_stamp() throws IOException {
stdin_operation("stamp");
}
@Test
public void stdin_multistamp() throws IOException {
stdin_operation("multistamp");
}
@Test
public void background_stdin() throws IOException {
operation_stdin("background");
}
@Test
public void multibackground_stdin() throws IOException {
operation_stdin("multibackground");
}
@Test
public void stamp_stdin() throws IOException {
operation_stdin("stamp");
}
@Test
public void multistamp_stdin() throws IOException {
operation_stdin("multistamp");
}
};
|