@Test public void testBuild() { final String username = "user"; final String salt = "salt"; final URI privateKey = new File("temp/id_dsa").toURI(); final URI serverAddress = URI.create("sftp: final KeyCryptoProduct product = builder.setKeySalt(salt).setUsername(username).setPrivateKey(privateKey) .setServerAddress(serverAddress).build(); assertEquals("Username does not match.", username, product.getUsername()); assertEquals("Salt does not match.", salt, product.getKeySalt()); assertEquals("Private key location does not match.", privateKey.toString(), product.getPrivateKey().toString()); assertEquals("Server address does not match.", serverAddress.toString(), product.getServerAddress().toString()); }
@Override public KeyCryptoProduct build() { for (final Attribute a : Attribute.values()) { if (!isSet(a)) { throw new IllegalStateException("Unset attribute: " + a.toString()); } } return new KeyCryptoProductImpl(username, keySalt, privateKey, serverAddress); }
SimpleKeyCryptoBuilder extends KeyCryptoBuilder { @Override public KeyCryptoProduct build() { for (final Attribute a : Attribute.values()) { if (!isSet(a)) { throw new IllegalStateException("Unset attribute: " + a.toString()); } } return new KeyCryptoProductImpl(username, keySalt, privateKey, serverAddress); } }
SimpleKeyCryptoBuilder extends KeyCryptoBuilder { @Override public KeyCryptoProduct build() { for (final Attribute a : Attribute.values()) { if (!isSet(a)) { throw new IllegalStateException("Unset attribute: " + a.toString()); } } return new KeyCryptoProductImpl(username, keySalt, privateKey, serverAddress); }  }
SimpleKeyCryptoBuilder extends KeyCryptoBuilder { @Override public KeyCryptoProduct build() { for (final Attribute a : Attribute.values()) { if (!isSet(a)) { throw new IllegalStateException("Unset attribute: " + a.toString()); } } return new KeyCryptoProductImpl(username, keySalt, privateKey, serverAddress); }  @Override KeyCryptoProduct build(); @Override KeyCryptoBuilder setKeySalt(final String keySalt); @Override KeyCryptoBuilder setPrivateKey(final URI privateKey); @Override KeyCryptoBuilder setServerAddress(final URI serverAddress); @Override KeyCryptoBuilder setUsername(final String username); }
SimpleKeyCryptoBuilder extends KeyCryptoBuilder { @Override public KeyCryptoProduct build() { for (final Attribute a : Attribute.values()) { if (!isSet(a)) { throw new IllegalStateException("Unset attribute: " + a.toString()); } } return new KeyCryptoProductImpl(username, keySalt, privateKey, serverAddress); }  @Override KeyCryptoProduct build(); @Override KeyCryptoBuilder setKeySalt(final String keySalt); @Override KeyCryptoBuilder setPrivateKey(final URI privateKey); @Override KeyCryptoBuilder setServerAddress(final URI serverAddress); @Override KeyCryptoBuilder setUsername(final String username);  }