2  * ================================================================================
 
   3  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
 
   4  * ================================================================================
 
   5  * Copyright Copyright (c) 2019 IBM
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.dcae.analytics.web.validation;
 
  23 import java.util.HashMap;
 
  24 import java.util.HashSet;
 
  28 import org.junit.jupiter.api.Assertions;
 
  29 import org.junit.jupiter.api.BeforeAll;
 
  30 import org.junit.jupiter.api.Test;
 
  32 public class GenericValidationResponseTest {
 
  34     public static GenericValidationResponse genericValidationResponse;
 
  37     static void beforeAll() {
 
  38         genericValidationResponse = new GenericValidationResponse();
 
  42     public void testGenericValidationResponse() {
 
  43         boolean hasError = genericValidationResponse.hasErrors();
 
  44         Set<String> set = new HashSet<>();
 
  45         Map<String, String> map = new HashMap<>();
 
  47         Assertions.assertEquals(false, hasError);
 
  48         Assertions.assertEquals(set, genericValidationResponse.getFieldNamesWithError());
 
  49         Assertions.assertNotNull(genericValidationResponse.getErrorMessages());
 
  50         Assertions.assertEquals(map, genericValidationResponse.getValidationResultsAsMap());
 
  51         Assertions.assertEquals(errorMsg, genericValidationResponse.getAllErrorMessage());
 
  52         Assertions.assertEquals(errorMsg, genericValidationResponse.getAllErrorMessage("testMsg"));