summaryrefslogtreecommitdiffstats
path: root/nsh/impl/src
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-11-21 15:06:16 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-11-24 06:54:46 +0000
commitf698c1ccc38646129ee4a15adacdf47942a24a52 (patch)
tree779e64002860a328f121dc3f2b958b8225c5c0c7 /nsh/impl/src
parent294d0ea77bd20d580405cc1470dc9a1078be7a5c (diff)
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 <jsrnicek@cisco.com>
Diffstat (limited to 'nsh/impl/src')
-rw-r--r--nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java38
-rw-r--r--nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizerTest.java42
2 files changed, 40 insertions, 40 deletions
diff --git a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java
index d519122cb..c91360eb6 100644
--- a/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.java
+++ b/nsh/impl/src/test/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizerTest.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.NshAddDelEntry;
import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply;
@@ -54,14 +54,6 @@ public class NshEntryWriterCustomizerTest extends WriterCustomizerTest {
private NshEntryWriterCustomizer customizer;
- @Override
- public void setUp() throws Exception {
- nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME);
- defineMapping(mappingContext, ENTRY_NAME, ENTRY_INDEX, ENTRY_CTX_NAME);
-
- customizer = new NshEntryWriterCustomizer(jvppNsh, nshContext);
- }
-
private static NshEntry generateNshEntry(final String name) {
final NshEntryBuilder builder = new NshEntryBuilder();
builder.setName(name);
@@ -88,16 +80,6 @@ public class NshEntryWriterCustomizerTest extends WriterCustomizerTest {
.child(NshEntry.class, new NshEntryKey(name));
}
- private void whenNshAddDelEntryThenSuccess() {
- final NshAddDelEntryReply reply = new NshAddDelEntryReply();
- reply.entryIndex = ENTRY_INDEX;
- doReturn(future(reply)).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class));
- }
-
- private void whenNshAddDelEntryThenFailure() {
- doReturn(failedFuture()).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class));
- }
-
private static NshAddDelEntry generateNshAddDelEntry(final byte isAdd) {
final NshAddDelEntry request = new NshAddDelEntry();
request.isAdd = isAdd;
@@ -114,6 +96,24 @@ public class NshEntryWriterCustomizerTest extends WriterCustomizerTest {
return request;
}
+ @Override
+ public void setUpTest() throws Exception {
+ nshContext = new NamingContext("nsh_entry", ENTRY_CTX_NAME);
+ defineMapping(mappingContext, ENTRY_NAME, ENTRY_INDEX, ENTRY_CTX_NAME);
+
+ customizer = new NshEntryWriterCustomizer(jvppNsh, nshContext);
+ }
+
+ private void whenNshAddDelEntryThenSuccess() {
+ final NshAddDelEntryReply reply = new NshAddDelEntryReply();
+ reply.entryIndex = ENTRY_INDEX;
+ doReturn(future(reply)).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class));
+ }
+
+ private void whenNshAddDelEntryThenFailure() {
+ doReturn(failedFuture()).when(jvppNsh).nshAddDelEntry(any(NshAddDelEntry.class));
+ }
+
@Test
public void testCreate() throws Exception {
final NshEntry nshEntry = generateNshEntry(ENTRY_NAME);
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);