MatchUtils { public static MatchBuilder createEthMatch(MatchBuilder matchBuilder, MacAddress srcMac, MacAddress dstMac) { Preconditions.checkNotNull(matchBuilder); EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); if (srcMac != null) { EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); ethSourceBuilder.setAddress(srcMac); ethernetMatch.setEthernetSource(ethSourceBuilder.build()); } if (dstMac != null) { EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(dstMac); ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); } matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; } private  MatchUtils(); static MatchBuilder createEthMatch(MatchBuilder matchBuilder, MacAddress srcMac, MacAddress dstMac);  }
@Test public void testCreateEthMatch() { result = MatchUtils.createEthMatch(matchBuilderMock, macAddressMock, macAddressMock); Assert.assertNotNull(result); }
@Test(expected = NullPointerException.class) public void testThrowNullPointerException() { MatchUtils.createEthMatch(null, macAddressMock, macAddressMock); MatchUtils.createEthMatch(matchBuilderMock, null, macAddressMock); MatchUtils.createEthMatch(matchBuilderMock, macAddressMock, null); MatchUtils.createEthMatch(null, null, null); }