Update junits for locate and gui
[aaf/authz.git] / auth / auth-locate / src / test / java / org / onap / aaf / auth / locate / JU_BasicAuthCodeTest.java
index 03b3ec6..31876fe 100644 (file)
@@ -18,7 +18,6 @@
  * ============LICENSE_END====================================================\r
  *\r
  */\r
-\r
 package org.onap.aaf.auth.locate;\r
 \r
 import static org.junit.Assert.assertEquals;\r
@@ -42,75 +41,74 @@ import org.onap.aaf.cadi.principal.X509Principal;
 import org.onap.aaf.misc.env.LogTarget;\r
 \r
 public class JU_BasicAuthCodeTest {\r
+       @Mock\r
+       AAFAuthn authn;\r
 \r
-    @Mock\r
-    AAFAuthn authn;\r
-\r
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)\r
-    AuthzTrans trans;\r
+       @Mock(answer = Answers.RETURNS_DEEP_STUBS)\r
+       AuthzTrans trans;\r
 \r
-    @Mock\r
-    HttpServletRequest req;\r
+       @Mock\r
+       HttpServletRequest req;\r
 \r
-    @Mock\r
-    HttpServletResponse resp;\r
+       @Mock\r
+       HttpServletResponse resp;\r
 \r
-    @Mock\r
-    LogTarget error;\r
+       @Mock\r
+       LogTarget error;\r
 \r
-    @Mock\r
-    LocateFacade facade;\r
+       @Mock\r
+       LocateFacade facade;\r
 \r
-    @Mock\r
-    BasicPrincipal basicPrincipal;\r
-    @Mock\r
-    X509Principal x509Principal;\r
+       @Mock\r
+       BasicPrincipal basicPrincipal;\r
+       @Mock\r
+       X509Principal x509Principal;\r
 \r
-    @Before\r
-    public void setUp() throws Exception {\r
-        initMocks(this);\r
-    }\r
+       @Before\r
+       public void setUp() throws Exception {\r
+               initMocks(this);\r
+       }\r
 \r
-    @Test\r
-    public void testWithNullUserPrincipal() throws Exception {\r
-        BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade);\r
-        LocateCode locateCode = basicAuthCode.clone(facade, false);\r
+       @Test\r
+       public void testWithNullUserPrincipal() throws Exception {\r
+               BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade);\r
+               LocateCode locateCode = basicAuthCode.clone(facade, false);\r
 \r
-        assertEquals(locateCode.desc(), basicAuthCode.desc());\r
+               assertEquals(locateCode.desc(), basicAuthCode.desc());\r
 \r
-        when(trans.getUserPrincipal()).thenReturn(null);\r
-        when(trans.error()).thenReturn(error);\r
+               when(trans.getUserPrincipal()).thenReturn(null);\r
+               when(trans.error()).thenReturn(error);\r
 \r
-        basicAuthCode.handle(trans, req, resp);\r
-    }\r
+               basicAuthCode.handle(trans, req, resp);\r
+       }\r
 \r
-    @Test\r
-    public void testWithBasicUserPrincipal() throws Exception {\r
-        BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade);\r
-        LocateCode locateCode = basicAuthCode.clone(facade, false);\r
+       @Test\r
+       public void testWithBasicUserPrincipal() throws Exception {\r
+               BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade);\r
+               LocateCode locateCode = basicAuthCode.clone(facade, false);\r
 \r
-        assertEquals(locateCode.desc(), basicAuthCode.desc());\r
+               assertEquals(locateCode.desc(), basicAuthCode.desc());\r
 \r
-        when(trans.getUserPrincipal()).thenReturn(basicPrincipal);\r
+               when(trans.getUserPrincipal()).thenReturn(basicPrincipal);\r
 \r
-        basicAuthCode.handle(trans, req, resp);\r
+               basicAuthCode.handle(trans, req, resp);\r
 \r
-        verify(resp).setStatus(HttpStatus.OK_200);\r
-    }\r
+               verify(resp).setStatus(HttpStatus.OK_200);\r
+       }\r
 \r
-    @Test\r
-    public void testWithX509UserPrincipal() throws Exception {\r
-        BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade);\r
-        LocateCode locateCode = basicAuthCode.clone(facade, false);\r
+       @Test\r
+       public void testWithX509UserPrincipal() throws Exception {\r
+               BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade);\r
+               LocateCode locateCode = basicAuthCode.clone(facade, false);\r
 \r
-        assertEquals(locateCode.desc(), basicAuthCode.desc());\r
+               assertEquals(locateCode.desc(), basicAuthCode.desc());\r
 \r
-        when(trans.getUserPrincipal()).thenReturn(x509Principal);\r
-        when(req.getHeader("Authorization")).thenReturn("Basic 76//76");\r
+               when(trans.getUserPrincipal()).thenReturn(x509Principal);\r
+               when(req.getHeader("Authorization")).thenReturn("Basic 76//76");\r
 \r
-        basicAuthCode.handle(trans, req, resp);\r
+               basicAuthCode.handle(trans, req, resp);\r
 \r
-        verify(resp).setStatus(HttpStatus.FORBIDDEN_403);\r
-    }\r
+               verify(resp).setStatus(HttpStatus.FORBIDDEN_403);\r
+       }\r
 \r
 }\r