コード例 #1
0
 @Test
 public void testValidation() {
   try {
     PrintSpecFormConfigurator.configure(spec, form("width", "xyz"));
     fail("expected exception");
   } catch (PrintSpecException pse) {
     // make sure it's mentioned somewhere
     assertTrue(pse.getMessage().indexOf("width") >= 0);
   }
   try {
     PrintSpecFormConfigurator.configure(spec, form("height", "xyz"));
     fail("expected exception");
   } catch (PrintSpecException pse) {
     // make sure it's mentioned somewhere
     assertTrue(pse.getMessage().indexOf("height") >= 0);
   }
   try {
     PrintSpecFormConfigurator.configure(spec, form("auth", "1,2"));
     fail("expected exception");
   } catch (PrintSpecException pse) {
     // make sure it's mentioned somewhere
     assertTrue(pse.getMessage().indexOf("auth") >= 0);
   }
   try {
     PrintSpecFormConfigurator.configure(spec, form("cookie", "1,2"));
     fail("expected exception");
   } catch (PrintSpecException pse) {
     // make sure it's mentioned somewhere
     assertTrue(pse.getMessage().indexOf("cookie") >= 0);
   }
 }
コード例 #2
0
 @Test
 public void testMultipleAuth() {
   PrintSpecFormConfigurator.configure(spec, form("auth", "a,b,c", "auth", "d,e,f"));
   assertNotNull(spec.getCredentials("a"));
   assertNotNull(spec.getCredentials("d"));
   // @todo see note in class javadoc
   //        assertEquals(2, records.records.size());
 }