@SuppressWarnings("unchecked")
  @Test
  public void testExecute() throws Exception {
    protocolRemovedCommand = mock(ProtocolRemovedCommand.class, Mockito.CALLS_REAL_METHODS);

    PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(InstanceIdentifier.class));

    ProtocolEntry protocol = mock(ProtocolEntry.class);
    when(protocol.getProtocol())
        .thenAnswer(
            new Answer<Class<? extends OvsdbBridgeProtocolBase>>() {
              public Class<? extends OvsdbBridgeProtocolBase> answer(InvocationOnMock invocation)
                  throws Throwable {
                return OvsdbBridgeProtocolOpenflow10.class;
              }
            });
    Optional<ProtocolEntry> operationalProtocolEntryOptional = mock(Optional.class);
    when(operationalProtocolEntryOptional.isPresent()).thenReturn(true);
    when(operationalProtocolEntryOptional.get()).thenReturn(protocol);

    BridgeOperationalState bridgeOpState = mock(BridgeOperationalState.class);
    when(bridgeOpState.getProtocolEntry(any(InstanceIdentifier.class)))
        .thenReturn(operationalProtocolEntryOptional);

    MemberModifier.suppress(
        MemberMatcher.method(ProtocolUpdateCommand.class, "getOperationalState"));
    when(protocolRemovedCommand.getOperationalState()).thenReturn(bridgeOpState);

    InstanceIdentifier<ProtocolEntry> protocolIid = mock(InstanceIdentifier.class);
    removed.add(protocolIid);
    MemberModifier.field(ProtocolRemovedCommand.class, "removed")
        .set(protocolRemovedCommand, removed);

    MemberModifier.field(ProtocolRemovedCommand.class, "updatedBridges")
        .set(protocolRemovedCommand, updatedBridges);
    when(updatedBridges.get(any(InstanceIdentifier.class)))
        .thenReturn(mock(OvsdbBridgeAugmentation.class));

    Operations op = (Operations) setField("op");
    Mutate<GenericTableSchema> mutate = mock(Mutate.class);
    when(op.mutate(any(Bridge.class))).thenReturn(mutate);
    Column<GenericTableSchema, Set<String>> column = mock(Column.class);
    Bridge bridge = mock(Bridge.class);
    when(bridge.getProtocolsColumn()).thenReturn(column);
    when(column.getSchema()).thenReturn(mock(ColumnSchema.class));
    when(column.getData()).thenReturn(new HashSet<String>());
    when(mutate.addMutation(any(ColumnSchema.class), any(Mutator.class), any(Set.class)))
        .thenReturn(mutate);

    PowerMockito.mockStatic(TyperUtils.class);
    when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), any(Class.class)))
        .thenReturn(bridge);

    TransactionBuilder transaction = mock(TransactionBuilder.class);
    protocolRemovedCommand.execute(transaction);
    Mockito.verify(transaction).add(any(Operation.class));
  }
  @Before
  public void setUp() throws Exception {
    pluginId = UUID.randomUUID();
    digitalAssetCryptoTransactionFactory =
        new DigitalAssetCryptoTransactionFactory(
            this.pluginId,
            this.cryptoVaultManager,
            this.bitcoinWalletManager,
            this.pluginDatabaseSystem,
            this.pluginFileSystem,
            this.assetVaultManager,
            this.cryptoAddressBookManager,
            this.outgoingIntraActorManager);
    digitalAssetCryptoTransactionFactory.setErrorManager(errorManager);
    digitalAssetCryptoTransactionFactory.setAssetIssuingTransactionDao(assetIssuingTransactionDao);

    MemberModifier.field(AssetIssuingTransactionDao.class, "database")
        .set(assetIssuingTransactionDao, database);

    assetPublicKey = "assetPublicKey";
  }