GBP ofoverlay.sf test improvements
[groupbasedpolicy.git] / renderers / ofoverlay / src / test / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / sf / ClassificationResultTest.java
old mode 100644 (file)
new mode 100755 (executable)
index b68f4a2..3a5111b
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015 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
@@ -8,55 +8,56 @@
 
 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 
 public class ClassificationResultTest {
 
-    private ClassificationResult result;
-
-    private MatchBuilder matchBuilder;
     private List<MatchBuilder> matches;
     private String errorMessage = "errorMessage";
 
     @Before
-    public void initialise() {
-        matchBuilder = mock(MatchBuilder.class);
-        matches = Arrays.asList(matchBuilder);
+    public void init() {
+        MatchBuilder matchBuilder = mock(MatchBuilder.class);
+        matches = Collections.singletonList(matchBuilder);
     }
 
     @Test
-    public void getMatchBuildersTestSuccess() {
-        result = new ClassificationResult(matches);
-        Assert.assertEquals(matches, result.getMatchBuilders());
+    public void testGetMatchBuilders_Success() {
+        ClassificationResult result = new ClassificationResult(matches);
+        assertEquals(matches, result.getMatchBuilders());
     }
 
     @Test(expected = IllegalStateException.class)
-    public void getMatchBuildersTestFailure() {
-        result = new ClassificationResult(errorMessage);
+    public void testGetMatchBuilders_Failure() {
+        ClassificationResult result = new ClassificationResult(errorMessage);
         result.getMatchBuilders();
     }
 
     @Test
-    public void getErrorMessageTest() {
-        result = new ClassificationResult(errorMessage);
-        Assert.assertEquals(errorMessage, result.getErrorMessage());
-        result = new ClassificationResult(matches);
-        Assert.assertTrue(result.getErrorMessage().isEmpty());
+    public void testGetErrorMessage() {
+        ClassificationResult result1 = new ClassificationResult(errorMessage);
+        assertEquals(errorMessage, result1.getErrorMessage());
+
+        ClassificationResult result2 = new ClassificationResult(matches);
+        assertTrue(result2.getErrorMessage().isEmpty());
     }
 
     @Test
-    public void isSuccessfullTest() {
-        result = new ClassificationResult(errorMessage);
-        Assert.assertFalse(result.isSuccessfull());
-        result = new ClassificationResult(matches);
-        Assert.assertTrue(result.isSuccessfull());
+    public void testIsSuccessfull() {
+        ClassificationResult result1 = new ClassificationResult(errorMessage);
+        assertFalse(result1.isSuccessfull());
+
+        ClassificationResult result2 = new ClassificationResult(matches);
+        assertTrue(result2.isSuccessfull());
     }
 }