From f698c1ccc38646129ee4a15adacdf47942a24a52 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Mon, 21 Nov 2016 15:06:16 +0100 Subject: HONEYCOMB-275 - compilation error with HC runner and setUp Refactored setUp() method in WriteCustomizerTest to not trigger http://errorprone.info/bugpattern/JUnit4SetUpNotRun while used in combination with @RunWith(HoneycombTestRunner.class) Change-Id: Iba56b39399ddd7678dda97e094e935a3f02dd22c Signed-off-by: Jan Srnicek --- .../impl/config/NshMapWriterCustomizerTest.java | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java') diff --git a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java index 3794d805e..e5f82b3a7 100644 --- a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java +++ b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java @@ -22,9 +22,9 @@ import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; +import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.vpp.jvpp.VppBaseCallException; import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap; import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply; @@ -58,16 +58,6 @@ public class NshMapWriterCustomizerTest extends WriterCustomizerTest { private NshMapWriterCustomizer customizer; - @Override - public void setUp() throws Exception { - nshContext = new NamingContext("nsh_map", MAP_CTX_NAME); - defineMapping(mappingContext, MAP_NAME, MAP_INDEX, MAP_CTX_NAME); - interfaceContext = new NamingContext("interface", INT_CTX_NAME); - defineMapping(mappingContext, ITF_NAME, ITF_INDEX, INT_CTX_NAME); - - customizer = new NshMapWriterCustomizer(jvppNsh, nshContext, interfaceContext); - } - private static NshMap generateNshMap(final String name) { final NshMapBuilder builder = new NshMapBuilder(); builder.setName(name); @@ -88,16 +78,6 @@ public class NshMapWriterCustomizerTest extends WriterCustomizerTest { .child(NshMap.class, new NshMapKey(name)); } - private void whenNshAddDelMapThenSuccess() { - final NshAddDelMapReply reply = new NshAddDelMapReply(); - reply.mapIndex = MAP_INDEX; - doReturn(future(reply)).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); - } - - private void whenNshAddDelMapThenFailure() { - doReturn(failedFuture()).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); - } - private static NshAddDelMap generateNshAddDelMap(final byte isAdd) { final NshAddDelMap request = new NshAddDelMap(); request.isAdd = isAdd; @@ -110,6 +90,26 @@ public class NshMapWriterCustomizerTest extends WriterCustomizerTest { return request; } + @Override + public void setUpTest() throws Exception { + nshContext = new NamingContext("nsh_map", MAP_CTX_NAME); + defineMapping(mappingContext, MAP_NAME, MAP_INDEX, MAP_CTX_NAME); + interfaceContext = new NamingContext("interface", INT_CTX_NAME); + defineMapping(mappingContext, ITF_NAME, ITF_INDEX, INT_CTX_NAME); + + customizer = new NshMapWriterCustomizer(jvppNsh, nshContext, interfaceContext); + } + + private void whenNshAddDelMapThenSuccess() { + final NshAddDelMapReply reply = new NshAddDelMapReply(); + reply.mapIndex = MAP_INDEX; + doReturn(future(reply)).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); + } + + private void whenNshAddDelMapThenFailure() { + doReturn(failedFuture()).when(jvppNsh).nshAddDelMap(any(NshAddDelMap.class)); + } + @Test public void testCreate() throws Exception { final NshMap nshMap = generateNshMap(MAP_NAME); -- cgit 1.2.3-korg