### Question:
OpenVSwitchUpdateCommand extends AbstractTransactionCommand { private void setExternalIds(ReadWriteTransaction transaction, OvsdbNodeAugmentationBuilder ovsdbNodeBuilder, OpenVSwitch oldEntry, OpenVSwitch openVSwitch) { Map<String, String> oldExternalIds = null; Map<String, String> externalIds = null; if (openVSwitch.getExternalIdsColumn() != null) { externalIds = openVSwitch.getExternalIdsColumn().getData(); } if (oldEntry != null && oldEntry.getExternalIdsColumn() != null) { oldExternalIds = oldEntry.getExternalIdsColumn().getData(); } if (oldExternalIds == null || oldExternalIds.isEmpty()) { setNewExternalIds(ovsdbNodeBuilder, externalIds); } else if (externalIds != null && !externalIds.isEmpty()) { removeExternalIds(transaction, oldExternalIds, openVSwitch); setNewExternalIds(ovsdbNodeBuilder, externalIds); } } OpenVSwitchUpdateCommand(InstanceIdentifierCodec instanceIdentifierCodec, OvsdbConnectionInstance key,
            TableUpdates updates, DatabaseSchema dbSchema); @Override void execute(ReadWriteTransaction transaction);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testSetExternalIds() throws Exception { OpenVSwitch oldEntry = mock(OpenVSwitch.class); OpenVSwitch openVSwitch = mock(OpenVSwitch.class); Column<GenericTableSchema, Map<String, String>> column = mock(Column.class); when(openVSwitch.getExternalIdsColumn()).thenReturn(column); when(column.getData()).thenReturn(ImmutableMap.of("foo", "bar")); when(oldEntry.getExternalIdsColumn()).thenReturn(column); doNothing().when(openVSwitchUpdateCommand).removeExternalIds(any(ReadWriteTransaction.class), any(Map.class), any(OpenVSwitch.class)); doNothing().when(openVSwitchUpdateCommand).setNewExternalIds( any(OvsdbNodeAugmentationBuilder.class), any(Map.class)); ReadWriteTransaction transaction = mock(ReadWriteTransaction.class); OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = mock(OvsdbNodeAugmentationBuilder.class); Whitebox.invokeMethod(openVSwitchUpdateCommand, "setExternalIds", transaction, ovsdbNodeBuilder, oldEntry, openVSwitch); verify(openVSwitch, times(2)).getExternalIdsColumn(); verify(oldEntry, times(2)).getExternalIdsColumn(); verify(openVSwitchUpdateCommand).removeExternalIds(any(ReadWriteTransaction.class), any(Map.class), any(OpenVSwitch.class)); }