AAI-1523 Batch reformat aai-core
[aai/aai-common.git] / aai-core / src / test / java / org / onap / aai / serialization / queryformats / utils / UrlBuilderTest.java
index 397999e..08d29cd 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.aai.serialization.queryformats.utils;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.Before;
 import org.junit.Test;
@@ -30,70 +39,62 @@ import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexExcepti
 import org.onap.aai.setup.SchemaVersion;
 import org.onap.aai.util.AAIConstants;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
+public class UrlBuilderTest extends AAISetup {
 
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
+    @Mock
+    private DBSerializer serializer;
+    @Mock
+    private Vertex v;
 
-public class UrlBuilderTest extends AAISetup {
+    private static final String uri = "/test/uri";
+    private static final Object vId = new Long(123);
+    private static final String protocolAndHost = "http://localhost/aai/";
+
+    @Before
+    public void before() throws UnsupportedEncodingException, URISyntaxException {
+        MockitoAnnotations.initMocks(this);
+        when(serializer.getURIForVertex(any(Vertex.class))).thenReturn(new URI(uri));
+        when(v.id()).thenReturn(vId);
+    }
+
+    @Test
+    public void v11Pathed() throws AAIFormatVertexException {
+        SchemaVersion version = new SchemaVersion("v11");
+        UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
+        String result = builder.pathed(v);
+
+        assertEquals("has no protocol and host", basePath + "/" + version + uri, result);
+
+    }
+
+    @Test
+    public void v11Id() {
+        SchemaVersion version = new SchemaVersion("v11");
+        UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
+        String result = builder.id(v);
+
+        assertEquals("has no protocol and host", basePath + "/" + version + "/resources/id/" + vId, result);
+
+    }
+
+    @Test
+    public void beforeV11Pathed() throws AAIFormatVertexException {
+        SchemaVersion version = new SchemaVersion("v10");
+        UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
+        String result = builder.pathed(v);
+
+        assertEquals("has protocol and host", protocolAndHost + version + uri, result);
+
+    }
+
+    @Test
+    public void beforeV11Id() {
+        SchemaVersion version = new SchemaVersion("v10");
+        UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
+        String result = builder.id(v);
+
+        assertEquals("has protocol and host", protocolAndHost + version + "/resources/id/" + vId, result);
+
+    }
 
-       @Mock
-       private DBSerializer serializer;
-       @Mock
-       private Vertex v;
-
-       private static final String uri = "/test/uri";
-       private static final Object vId = new Long(123);
-       private static final String protocolAndHost = "http://localhost/aai/";
-
-       @Before
-       public void before() throws UnsupportedEncodingException, URISyntaxException {
-               MockitoAnnotations.initMocks(this);
-               when(serializer.getURIForVertex(any(Vertex.class))).thenReturn(new URI(uri));
-               when(v.id()).thenReturn(vId);
-       }
-
-       @Test
-       public void v11Pathed() throws AAIFormatVertexException {
-               SchemaVersion version = new SchemaVersion("v11");
-               UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
-               String result = builder.pathed(v);
-               
-               assertEquals("has no protocol and host", basePath + "/"+ version + uri, result);
-               
-       }
-
-       @Test
-       public void v11Id() {
-               SchemaVersion version = new SchemaVersion("v11");
-               UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
-               String result = builder.id(v);
-               
-               assertEquals("has no protocol and host", basePath + "/"+ version + "/resources/id/" + vId, result);
-               
-       }
-       
-       @Test
-       public void beforeV11Pathed() throws AAIFormatVertexException {
-               SchemaVersion version = new SchemaVersion("v10");
-               UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
-               String result = builder.pathed(v);
-               
-               assertEquals("has protocol and host", protocolAndHost + version + uri, result);
-               
-       }
-       
-       @Test
-       public void beforeV11Id() {
-               SchemaVersion version = new SchemaVersion("v10");
-               UrlBuilder builder = new UrlBuilder(version, serializer, protocolAndHost, schemaVersions, basePath);
-               String result = builder.id(v);
-               
-               assertEquals("has protocol and host", protocolAndHost + version + "/resources/id/" + vId, result);
-               
-       }
-       
 }