DhcpSubnet mockSub = mock(DhcpSubnet.class);
when(mockSub.addDhcpHost()).thenReturn(mockDhcpHost);
when(mockSub.getDhcpHosts()).thenReturn(hosts);
//mockSubnetCollection
ResourceCollection mockSubnetCollection = mock(ResourceCollection.class);
when(mockSubnetCollection.get(anyInt())).thenReturn(mockSub);
//mockBridge
Bridge mockBridge = mock(Bridge.class);
when(api.addBridge().tenantId(anyString()).name(anyString()).create()).thenReturn(mockBridge);
when(mockBridge.getDhcpSubnets()).thenReturn(mockSubnetCollection);