X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=extension%2Fopenflowplugin-extension-nicira%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fextension%2Fvendor%2Fnicira%2Fconvertor%2Fmatch%2FEthTypeConvertorTest.java;h=33aa2f0ddd19ab858d6032278b433a3a4c826637;hb=04b9d446f179f2ac149e089d8692a3f721e4f1ff;hp=8ea3b0ace039ccd2becb38905e375c3a253cf848;hpb=a37af37bb414295b84582d5aa58dca955f2df49e;p=openflowplugin.git diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java index 8ea3b0ace0..33aa2f0ddd 100644 --- a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java +++ b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/EthTypeConvertorTest.java @@ -1,11 +1,10 @@ -/** +/* * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match; import static org.mockito.Mockito.when; @@ -14,9 +13,9 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.openflowplugin.extension.api.ExtensionAugment; import org.opendaylight.openflowplugin.extension.api.path.MatchPath; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry; @@ -47,28 +46,31 @@ public class EthTypeConvertorTest { private EthTypeConvertor ethTypeConvertor; @Before - public void setUp() throws Exception { + public void setUp() { final NxmOfEthTypeBuilder nxmOfEthTypeBuilder = new NxmOfEthTypeBuilder() .setValue(1); - final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = new NxAugMatchNodesNodeTableFlowBuilder(); + final NxAugMatchNodesNodeTableFlowBuilder nxAugMatchNotifUpdateFlowStatsBuilder = + new NxAugMatchNodesNodeTableFlowBuilder(); nxAugMatchNotifUpdateFlowStatsBuilder.setNxmOfEthType(nxmOfEthTypeBuilder.build()); final Augmentation extensionAugmentation = nxAugMatchNotifUpdateFlowStatsBuilder.build(); - when(extension.getAugmentation(Matchers.>>any())).thenReturn(extensionAugmentation); + when(extension.augmentation(ArgumentMatchers.any())) + .thenReturn(extensionAugmentation); ethTypeConvertor = new EthTypeConvertor(); } @Test - public void testConvert() throws Exception { - final MatchEntry matchEntry = ethTypeConvertor.convert(extension); - Assert.assertEquals(1, ((EthTypeCaseValue)matchEntry.getMatchEntryValue()).getEthTypeValues().getValue().intValue()); + public void testConvert() { + final MatchEntry converted = ethTypeConvertor.convert(extension); + Assert.assertEquals(1, ((EthTypeCaseValue)converted.getMatchEntryValue()) + .getEthTypeValues().getValue().intValue()); } @Test - public void testConvert1() throws Exception { + public void testConvert1() { final EthTypeValuesBuilder ethTypeValuesBuilder = new EthTypeValuesBuilder() .setValue(Integer.valueOf(1)); final EthTypeCaseValueBuilder ethTypeCaseValueBuilder = new EthTypeCaseValueBuilder() @@ -78,20 +80,28 @@ public class EthTypeConvertorTest { when(matchEntry.getMatchEntryValue()).thenReturn(ethTypeCaseValue); - final ExtensionAugment> extensionAugment = ethTypeConvertor.convert(matchEntry, MatchPath.PACKETRECEIVED_MATCH); - Assert.assertEquals(1, ((NxAugMatchNotifPacketIn)extensionAugment.getAugmentationObject()).getNxmOfEthType().getValue().intValue()); + final ExtensionAugment> extensionAugment = ethTypeConvertor + .convert(matchEntry, MatchPath.PACKET_RECEIVED_MATCH); + Assert.assertEquals(1, ((NxAugMatchNotifPacketIn) extensionAugment.getAugmentationObject()).getNxmOfEthType() + .getValue().intValue()); Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class); - final ExtensionAugment> extensionAugment1 = ethTypeConvertor.convert(matchEntry, MatchPath.SWITCHFLOWREMOVED_MATCH); - Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved)extensionAugment1.getAugmentationObject()).getNxmOfEthType().getValue().intValue()); + final ExtensionAugment> extensionAugment1 = ethTypeConvertor + .convert(matchEntry, MatchPath.SWITCH_FLOW_REMOVED_MATCH); + Assert.assertEquals(1, ((NxAugMatchNotifSwitchFlowRemoved) extensionAugment1.getAugmentationObject()) + .getNxmOfEthType().getValue().intValue()); Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class); - final ExtensionAugment> extensionAugment2 = ethTypeConvertor.convert(matchEntry, MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH); - Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow)extensionAugment2.getAugmentationObject()).getNxmOfEthType().getValue().intValue()); + final ExtensionAugment> extensionAugment2 = ethTypeConvertor + .convert(matchEntry, MatchPath.FLOWS_STATISTICS_UPDATE_MATCH); + Assert.assertEquals(1, ((NxAugMatchNodesNodeTableFlow) extensionAugment2.getAugmentationObject()) + .getNxmOfEthType().getValue().intValue()); Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class); - final ExtensionAugment> extensionAugment3 = ethTypeConvertor.convert(matchEntry, MatchPath.RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH); - Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats)extensionAugment3.getAugmentationObject()).getNxmOfEthType().getValue().intValue()); + final ExtensionAugment> extensionAugment3 = ethTypeConvertor + .convert(matchEntry, MatchPath.FLOWS_STATISTICS_RPC_MATCH); + Assert.assertEquals(1, ((NxAugMatchRpcGetFlowStats) extensionAugment3.getAugmentationObject()).getNxmOfEthType() + .getValue().intValue()); Assert.assertEquals(extensionAugment.getKey(), NxmOfEthTypeKey.class); } }