01: // Copyright © 2004-2005 Canoo Engineering AG, Switzerland.
02: package com.canoo.webtest.plugins.pdftest;
03:
04: import java.io.IOException;
05:
06: import com.canoo.webtest.self.ContextStub;
07: import com.canoo.webtest.steps.Step;
08:
09: /**
10: * @author Etienne Studer
11: * @author Marc Guillemot
12: */
13: public class PdfVerifyEncryptionStepTest extends
14: AbstractBaseVerifyPdfTestCase {
15:
16: protected Step createStep() {
17: return new PdfVerifyEncryptionStep();
18: }
19:
20: protected ContextStub createContext() {
21: return new PdfContextStub(PdfTestResources.ENCRYPTED_FILE);
22: }
23:
24: public void testCorrectStep() throws Exception {
25: final PdfVerifyEncryptionStep step = (PdfVerifyEncryptionStep) getStep();
26: step.setEncrypted(true);
27: step.setUserPassword("");
28: step.setOwnerPassword("mymaster");
29: executeStep(step);
30: }
31:
32: public void testIncorrectStep() throws IOException {
33: final PdfVerifyEncryptionStep step = (PdfVerifyEncryptionStep) getStep();
34: setFakedContext(new PdfContextStub(
35: PdfTestResources.DEFAULT_FILE));
36: step.setEncrypted(true);
37: assertFailOnExecute(step);
38: }
39: }
|