boolean thrown = false; try {   boolean ret = msg.verify(); assertTrue("Failed to verify SCEP message from Java Scep Client.", ret); } catch (IllegalArgumentException e) { thrown = true; } assertTrue(thrown);
boolean ret = msg.verify(); assertFalse("Failed to fail to verify SCEP message from Java Scep Client.", ret);
    public void test03TestJavaScepClient() throws Exception {        log.debug(">test03TestJavaScepClient()");        ScepRequestMessage msg = new ScepRequestMessage(scepclient);        // You should be able to get issuer DN before anything else        String issuerdn = msg.getIssuerDN();        log.debug("IssuerDN: " + issuerdn);        assertEquals("CN=AdminCA1,O=EJBCA Sample,C=SE", issuerdn);        if (msg.requireKeyInfo()) {            msg.setKeyInfo(caCert, privateKey);        }        boolean thrown = false;        try {            // We know this will throw an exception since scepclient doesn't work            // If it starts working we know there is something wrong            boolean ret = msg.verify();              assertTrue("Failed to verify SCEP message from Java Scep Client.", ret);        } catch (IllegalArgumentException e) {            thrown = true;        }        assertTrue(thrown);        /*        String dn = msg.getRequestDN();        log.debug("DN: " + dn);        assertEquals("C=SE,O=Foo,CN=openscep", dn);        String username = msg.getUsername();        assertEquals("openvpn", username);        String pwd = msg.getPassword();        log.debug("Pwd: " + pwd);        assertEquals("foo123", pwd);        */        log.debug("<test03TestJavaScepClient()");    }