}
+ public static class RemovePropertyTests extends Common {
+
+ @Test
+ public void removePropertySendsTheCorrectCommand() throws Exception {
+ TestFcpConnection fcpConnection = createConnectionThatSendsPropertyRemoved();
+ WebOfTrustPlugin webOfTrustPlugin = createWebOfTrustPlugin(fcpConnection);
+ webOfTrustPlugin.removeProperty(ownIdentity, "SomeProperty");
+ assertThat(fcpConnection.sentMessages.get(0), allOf(
+ isNamed(equalTo("FCPPluginMessage")),
+ hasField("Identifier", notNullValue()),
+ hasField("PluginName", equalTo("plugins.WebOfTrust.WebOfTrust")),
+ hasField("Param.Message", equalTo("RemoveProperty")),
+ hasField("Param.Identity", equalTo("own-id")),
+ hasField("Param.Property", equalTo("SomeProperty"))
+ ));
+ }
+
+ @Test
+ public void removePropertyThrowsExceptionWhenDifferentReplyIsSentByPlugin() {
+ FcpConnection fcpConnection = createConnectionThatSendsOtherMessage();
+ WebOfTrustPlugin webOfTrustPlugin = createWebOfTrustPlugin(fcpConnection);
+ assertThrows(FcpException.class, () -> webOfTrustPlugin.removeProperty(ownIdentity, "SomeProperty"));
+ }
+
+ private TestFcpConnection createConnectionThatSendsPropertyRemoved() {
+ return createConnection("PropertyRemoved");
+ }
+
+ private final OwnIdentity ownIdentity = new OwnIdentity("own-id", "Own ID", "or", "ir", emptyList(), emptyMap());
+
+ }
+
private static class Common {
@SafeVarargs