Sonar Fixes, Formatting
[aaf/authz.git] / cadi / aaf / src / test / java / org / onap / aaf / cadi / aaf / v2_0 / test / JU_AbsAAFLocator.java
index 825e3c9..5f5858c 100644 (file)
 
 package org.onap.aaf.cadi.aaf.v2_0.test;
 
-import static org.junit.Assert.*;
-import static org.hamcrest.CoreMatchers.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-import org.junit.*;
-import org.mockito.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
 import org.onap.aaf.cadi.Access;
 import org.onap.aaf.cadi.Locator.Item;
 import org.onap.aaf.cadi.LocatorException;
@@ -74,46 +79,23 @@ public class JU_AbsAAFLocator {
         // Test with http
         loc = new AAFLocatorStub(access, "httpname");
         assertThat(loc.getName(), is("httpname"));
-        assertThat(loc.getVersion(), is(Config.AAF_DEFAULT_VERSION));
+        assertThat(loc.getVersion(), is(Config.AAF_DEFAULT_API_VERSION));
         assertThat(loc.toString(), is("AAFLocator for " + "httpname" + " on " + loc.getURI()));
 
         loc = new AAFLocatorStub(access, "name");
         assertThat(loc.getName(), is("name"));
-        assertThat(loc.getVersion(), is(Config.AAF_DEFAULT_VERSION));
+        assertThat(loc.getVersion(), is(Config.AAF_DEFAULT_API_VERSION));
         loc = new AAFLocatorStub(access, "name:v2.0");
         assertThat(loc.getName(), is("name"));
         assertThat(loc.getVersion(), is("v2.0"));
     }
 
-    @Test
-    public void createTest() throws LocatorException {
-        AbsAAFLocator.setCreator(locatorCreatorMock);
-
-        assertThat(AbsAAFLocator.create("nonsense"), is(nullValue()));
-        assertThat(AbsAAFLocator.create("nonsense/locate"), is(nullValue()));
-        assertThat(AbsAAFLocator.create("nonsense/locate/"), is(nullValue()));
-        assertThat(AbsAAFLocator.create("nonsense/locate//"), is(nullValue()));
-        assertThat(AbsAAFLocator.create("nonsense/locate/name:v2.0"), is(nullValue()));
-
-        assertThat(AbsAAFLocator.create("http/locate/name:v2.0"), is(nullValue()));
-
-        doReturn(mock(AbsAAFLocator.class)).when(locatorCreatorMock).create(anyString(), anyString());
-        assertThat(AbsAAFLocator.create("http/locate/name:v2.0/path"), is(not(nullValue())));
-
-        AbsAAFLocator.setCreator(null);
-        assertThat(AbsAAFLocator.create("http/locate/name:v2.0"), is(nullValue()));
-
-        assertThat(AbsAAFLocator.create("http"), is(not(nullValue())));
-
-        AbsAAFLocator.setCreator(locatorCreatorMock);
-        assertThat(AbsAAFLocator.create("first", "second"), is(not(nullValue())));
-    }
 
     @Test
     public void nameFromLocatorURITest() throws LocatorException, URISyntaxException {
         AAFLocatorStub loc = new AAFLocatorStub(access, "name:v2.0");
         assertThat(loc.getNameFromURI(new URI("example.com")), is("example.com"));
-        assertThat(loc.getNameFromURI(new URI("example.com/extra/stuff")), is("example.com/extra/stuff"));
+        assertThat(loc.getNameFromURI(new URI("example.com/extra/stuff")), is("extra"));
         assertThat(loc.getNameFromURI(new URI("example.com/locate/stuff")), is("stuff")); // n' stuff
     }
 
@@ -167,7 +149,7 @@ public class JU_AbsAAFLocator {
         assertThat(loc.setPathInfo("pathInfo"), is(not(nullValue())));
         assertThat(loc.setQuery("query"), is(not(nullValue())));
         assertThat(loc.setFragment("fragment"), is(not(nullValue())));
-        
+
         assertThat(loc.exposeGetURI(uri), is(not(uri)));
     }