/** Test of validate method, of class Validator. */
  public void testValidate() throws Exception {
    System.out.println("validate - Simple");

    KeyPair pair = KeyManager.createKeyPair();
    License license = LicenseFactory.createLicense();
    license.addProperty("Name", "Jason Nichols");
    license.addProperty("Email", "*****@*****.**");
    license.addProperty("Gibberish", "qwertyasdfg");

    LicenseSigner signer = LicenseSigner.createLicenseSigner((DSAPrivateKey) pair.getPrivate());
    signer.sign(license);

    String key = new String(Hex.encodeHex(pair.getPublic().getEncoded()));
    Validator validator = new Validator(license, key);
    validator.validate();
  }
  public void testBlacklist() throws Exception {
    System.out.println("validate - Blacklist");

    KeyPair pair = KeyManager.createKeyPair();
    License license = LicenseFactory.createLicense();
    license.addProperty("Name", "Jason Nichols");
    license.addProperty("Email", "*****@*****.**");
    license.addProperty("Gibberish", "qwertyasdfg");

    LicenseSigner signer = LicenseSigner.createLicenseSigner((DSAPrivateKey) pair.getPrivate());
    signer.sign(license);

    String key = new String(Hex.encodeHex(pair.getPublic().getEncoded()));
    Validator validator = new Validator(license, key);
    validator.addBlacklistedLicense(license.getLicenseSignatureString());
    boolean ex = false;
    try {
      validator.validate();
    } catch (ValidatorException e) {
      System.out.println("\t" + e.getMessage());
      ex = true;
    }
    assertTrue(ex);
  }