X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-locate%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Flocate%2FJU_BasicAuthCodeTest.java;h=cdae121ab784ae717fa13166cd612390c1062cff;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=eea60eb0a3fb93b29fe6ae7c73c2f467d7667a49;hpb=824dc7b5fc0e1ccdf7f460479aff344727f0f01e;p=aaf%2Fauthz.git diff --git a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/JU_BasicAuthCodeTest.java b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/JU_BasicAuthCodeTest.java index eea60eb0..cdae121a 100644 --- a/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/JU_BasicAuthCodeTest.java +++ b/auth/auth-locate/src/test/java/org/onap/aaf/auth/locate/JU_BasicAuthCodeTest.java @@ -42,74 +42,74 @@ import org.onap.aaf.misc.env.LogTarget; public class JU_BasicAuthCodeTest { - @Mock - AAFAuthn authn; + @Mock + AAFAuthn authn; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) - AuthzTrans trans; + @Mock(answer = Answers.RETURNS_DEEP_STUBS) + AuthzTrans trans; - @Mock - HttpServletRequest req; + @Mock + HttpServletRequest req; - @Mock - HttpServletResponse resp; + @Mock + HttpServletResponse resp; - @Mock - LogTarget error; + @Mock + LogTarget error; - @Mock - LocateFacade facade; + @Mock + LocateFacade facade; - @Mock - BasicPrincipal basicPrincipal; - @Mock - X509Principal x509Principal; + @Mock + BasicPrincipal basicPrincipal; + @Mock + X509Principal x509Principal; - @Before - public void setUp() throws Exception { - initMocks(this); - } + @Before + public void setUp() throws Exception { + initMocks(this); + } - @Test - public void testWithNullUserPrincipal() throws Exception { - BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade); - LocateCode locateCode = basicAuthCode.clone(facade, false); + @Test + public void testWithNullUserPrincipal() throws Exception { + BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade); + LocateCode locateCode = basicAuthCode.clone(facade, false); - assertEquals(locateCode.desc(), basicAuthCode.desc()); + assertEquals(locateCode.desc(), basicAuthCode.desc()); - when(trans.getUserPrincipal()).thenReturn(null); - when(trans.error()).thenReturn(error); + when(trans.getUserPrincipal()).thenReturn(null); + when(trans.error()).thenReturn(error); - basicAuthCode.handle(trans, req, resp); - } + basicAuthCode.handle(trans, req, resp); + } - @Test - public void testWithBasicUserPrincipal() throws Exception { - BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade); - LocateCode locateCode = basicAuthCode.clone(facade, false); + @Test + public void testWithBasicUserPrincipal() throws Exception { + BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade); + LocateCode locateCode = basicAuthCode.clone(facade, false); - assertEquals(locateCode.desc(), basicAuthCode.desc()); + assertEquals(locateCode.desc(), basicAuthCode.desc()); - when(trans.getUserPrincipal()).thenReturn(basicPrincipal); + when(trans.getUserPrincipal()).thenReturn(basicPrincipal); - basicAuthCode.handle(trans, req, resp); + basicAuthCode.handle(trans, req, resp); - verify(resp).setStatus(HttpStatus.OK_200); - } + verify(resp).setStatus(HttpStatus.OK_200); + } - @Test - public void testWithX509UserPrincipal() throws Exception { - BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade); - LocateCode locateCode = basicAuthCode.clone(facade, false); + @Test + public void testWithX509UserPrincipal() throws Exception { + BasicAuthCode basicAuthCode = new BasicAuthCode(authn, facade); + LocateCode locateCode = basicAuthCode.clone(facade, false); - assertEquals(locateCode.desc(), basicAuthCode.desc()); + assertEquals(locateCode.desc(), basicAuthCode.desc()); - when(trans.getUserPrincipal()).thenReturn(x509Principal); - when(req.getHeader("Authorization")).thenReturn("Basic 76//76"); + when(trans.getUserPrincipal()).thenReturn(x509Principal); + when(req.getHeader("Authorization")).thenReturn("Basic 76//76"); - basicAuthCode.handle(trans, req, resp); + basicAuthCode.handle(trans, req, resp); - verify(resp).setStatus(HttpStatus.FORBIDDEN_403); - } + verify(resp).setStatus(HttpStatus.FORBIDDEN_403); + } }