### Question:
OvsdbPortUpdateCommand extends AbstractTransactionCommand { @VisibleForTesting void updatePortExternalIds(final Port port, final OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder) { Map<String, String> portExternalIds = port.getExternalIdsColumn().getData(); if (portExternalIds != null && !portExternalIds.isEmpty()) { List<PortExternalIds> externalIdsList = new ArrayList<>(); for (Entry<String, String> entry : portExternalIds.entrySet()) { String externalIdKey = entry.getKey(); String externalIdValue = entry.getValue(); if (externalIdKey != null && externalIdValue != null) { externalIdsList.add(new PortExternalIdsBuilder() .setExternalIdKey(externalIdKey) .setExternalIdValue(externalIdValue).build()); } } ovsdbTerminationPointBuilder.setPortExternalIds(externalIdsList); } } OvsdbPortUpdateCommand(InstanceIdentifierCodec instanceIdentifierCodec, OvsdbConnectionInstance key,
            TableUpdates updates, DatabaseSchema dbSchema); @Override void execute(ReadWriteTransaction transaction);  }### Answer:
@SuppressWarnings("unchecked") @Test public void testUpdatePortExternalIds() throws Exception { Port port = mock(Port.class); Column<GenericTableSchema, Map<String, String>> column = mock(Column.class); when(port.getExternalIdsColumn()).thenReturn(column); Map<String, String> map = new HashMap<>(); when(column.getData()).thenReturn(map); map.put(EXTERNAL_ID_KEY, EXTERNAL_ID_VALUE); when(column.getData()).thenReturn(map); PortExternalIdsBuilder portExternalIdsBuilder = mock(PortExternalIdsBuilder.class); PowerMockito.whenNew(PortExternalIdsBuilder.class).withNoArguments().thenReturn(portExternalIdsBuilder); when(portExternalIdsBuilder.setExternalIdKey(anyString())).thenReturn(portExternalIdsBuilder); when(portExternalIdsBuilder.setExternalIdValue(anyString())).thenReturn(portExternalIdsBuilder); when(portExternalIdsBuilder.build()).thenReturn(mock(PortExternalIds.class)); OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointBuilder = mock( OvsdbTerminationPointAugmentationBuilder.class); when(ovsdbTerminationPointBuilder.setPortExternalIds(any(List.class))).thenReturn(ovsdbTerminationPointBuilder); Whitebox.invokeMethod(ovsdbPortUpdateCommand, "updatePortExternalIds", port, ovsdbTerminationPointBuilder); verify(portExternalIdsBuilder).setExternalIdKey(anyString()); verify(portExternalIdsBuilder).setExternalIdValue(anyString()); }