X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcontroller%2FDictionaryImportControllerTest.java;h=ef723a3fdecf5521acb6cf0c9d5456b16c80abac;hp=7ab1b170ea61a7e835d2a1313ef7f5d6fee02a19;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java index 7ab1b170e..ef723a3fd 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-PAP-REST * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T 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. @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.pap.xacml.rest.controller; import static org.junit.Assert.assertTrue; @@ -42,7 +43,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.rest.dao.CommonClassDao; import org.springframework.mock.web.MockHttpServletResponse; -public class DictionaryImportControllerTest extends Mockito{ +public class DictionaryImportControllerTest extends Mockito { private static Logger logger = FlexLogger.getLogger(DictionaryImportController.class); @@ -59,20 +60,20 @@ public class DictionaryImportControllerTest extends Mockito{ controller = new DictionaryImportController(); new DictionaryImportController(commonClassDao); request = Mockito.mock(HttpServletRequest.class); - response = new MockHttpServletResponse(); + response = new MockHttpServletResponse(); } @Test - public void testIsValidDictionaryName(){ + public void testIsValidDictionaryName() { DictionaryImportController cotroller = new DictionaryImportController(); - //test invalid name + // test invalid name assertTrue(!cotroller.isValidDictionaryName("wrong-name")); - //test valid name + // test valid name assertTrue(cotroller.isValidDictionaryName("ActionList")); } @Test - public void testImportDictionaryData() throws ServletException, IOException{ + public void testImportDictionaryData() throws ServletException, IOException { List fileNames = new ArrayList<>(); fileNames.add("Attribute.csv"); fileNames.add("ActionPolicyDictionary.csv"); @@ -99,9 +100,9 @@ public class DictionaryImportControllerTest extends Mockito{ fileNames.add("Settings.csv"); fileNames.add("Zone.csv"); fileNames.add("ActionList.csv"); - for(int i =0; i < fileNames.size(); i++){ - File file = new File("src/test/resources/dictionaryImport/"+fileNames.get(i)); - try(FileInputStream targetStream = new FileInputStream(file)){ + for (int i = 0; i < fileNames.size(); i++) { + File file = new File("src/test/resources/dictionaryImport/" + fileNames.get(i)); + try (FileInputStream targetStream = new FileInputStream(file)) { PushPolicyControllerTest pushController = new PushPolicyControllerTest(); when(request.getInputStream()).thenReturn(pushController.getInputStream(getBytes(targetStream))); when(request.getParameter("userId")).thenReturn("demo");