From: Driptaroop Das Date: Fri, 11 Jan 2019 16:28:39 +0000 (+0530) Subject: Junit test file for FacadeImpl.java X-Git-Tag: 2.1.9~43^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F81%2F75681%2F2;p=aaf%2Fauthz.git Junit test file for FacadeImpl.java Junit test file for FacadeImpl.java Issue-ID: AAF-716 Change-Id: Ic9665fab2eb5b0cd8b021b90b4d65f99c34cda3f Signed-off-by: Driptaroop Das --- diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/layer/FacadeImplTest.java b/auth/auth-core/src/test/java/org/onap/aaf/auth/layer/FacadeImplTest.java new file mode 100644 index 00000000..241622fc --- /dev/null +++ b/auth/auth-core/src/test/java/org/onap/aaf/auth/layer/FacadeImplTest.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2019 IBM Intellectual Property. All rights reserved. + * * =========================================================================== + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * + ******************************************************************************/ + +package org.onap.aaf.auth.layer; + +import org.junit.Before; +import org.junit.Test; + +import javax.servlet.http.HttpServletResponse; + +import org.onap.aaf.misc.env.Data.TYPE; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class FacadeImplTest { + + FacadeImpl facade; + HttpServletResponse response; + + @Before + public void setUp() throws Exception { + facade = new FacadeImpl() { + }; + response = mock(HttpServletResponse.class); + } + + @Test + public void setContentType() { + TYPE type = TYPE.JSON; + facade.setContentType(response, type); + verify(response).setContentType("application/json"); + + type = TYPE.XML; + facade.setContentType(response, type); + verify(response).setContentType("text.xml"); + } + + @Test + public void setCacheControlOff() { + facade.setCacheControlOff(response); + verify(response).setHeader("Cache-Control", "no-store"); + verify(response).setHeader("Pragma", "no-cache"); + } +} \ No newline at end of file