### Question:
ForwardingManager { void createBridgeDomainOnNodes(SetMultimap<String, NodeId> vppNodesByBridgeDomain) { for (String bd : vppNodesByBridgeDomain.keySet()) { Optional<GbpBridgeDomain> bdConfig = readGbpBridgeDomainConfig(bd); Set<NodeId> vppNodes = vppNodesByBridgeDomain.get(bd); if (bdConfig.isPresent()) { if (bdConfig.get().getType().equals(VlanNetwork.class)) { createVlanBridgeDomains(bd, bdConfig.get().getVlan(), vppNodes); } } else { VxlanVni vxlanVni = vxlanVniByBridgeDomain.get(bd); if (vxlanVni == null) { vxlanVni = new VxlanVni(lastVxlanVni++); vxlanVniByBridgeDomain.put(bd, vxlanVni); } createVxlanBridgeDomains(bd, vxlanVni, vppNodes); } } } ForwardingManager(@Nonnull InterfaceManager ifaceManager, @Nonnull AclManager aclManager,
                             @Nonnull NatManager natManager, @Nonnull RoutingManager routingManager,
                             @Nonnull BridgeDomainManager bdManager, @Nonnull LispStateManager lispStateManager,
                             @Nonnull LoopbackManager loopbackManager, @Nonnull FlatOverlayManager flatOverlayManager,
                             @Nonnull DhcpRelayHandler dhcpRelayHandler, @Nonnull DataBroker dataBroker); static Optional<IpPrefix> resolveIpPrefix(RendererNetworkDomain rendDomain);  }### Answer:
@Test public void testCreateBridgeDomainOnNodes_vxlan() throws Exception { Mockito.when(bdManager.createVxlanBridgeDomainOnVppNode(Mockito.eq(BD_1), Mockito.any(VxlanVni.class), Mockito.eq(NODE_1))) .thenReturn(Futures.immediateFuture(null)); SetMultimap<String, NodeId> vppNodesByBd = ImmutableSetMultimap.of(BD_1, NODE_1); fwdManager.createBridgeDomainOnNodes(vppNodesByBd); Mockito.verify(bdManager).createVxlanBridgeDomainOnVppNode(Matchers.eq(BD_1), Matchers.any(VxlanVni.class), Matchers.eq(NODE_1)); }
@Test public void testCreateBridgeDomainOnNodes_vlan() throws Exception { Mockito.when(bdManager.createVlanBridgeDomainOnVppNode(Mockito.eq(BD_1), Mockito.any(VlanId.class), Mockito.eq(NODE_1))) .thenReturn(Futures.immediateFuture(null)); GbpBridgeDomain bd = new GbpBridgeDomainBuilder().setId(BD_1).setType(VlanNetwork.class).setVlan(VLAN_1).build(); InstanceIdentifier<GbpBridgeDomain> bdIid = InstanceIdentifier.builder(Config.class).child(GbpBridgeDomain.class, bd.getKey()).build(); WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.CONFIGURATION, bdIid, bd); wTx.submit().get(); SetMultimap<String, NodeId> vppNodesByBd = ImmutableSetMultimap.of(BD_1, NODE_1); fwdManager.createBridgeDomainOnNodes(vppNodesByBd); Mockito.verify(bdManager).createVlanBridgeDomainOnVppNode(Matchers.eq(BD_1), Matchers.eq(VLAN_1), Matchers.eq(NODE_1)); }