* 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.
package org.openecomp.sdc.be.datatypes.enums;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum.CATEGORY;
+import static org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum.RESOURCE_TYPE;
+import static org.openecomp.sdc.be.datatypes.enums.FilterKeyEnum.VERSION;
import java.util.List;
-
-public class FilterKeyEnumTest {
-
- private FilterKeyEnum createTestSubject() {
- return FilterKeyEnum.CATEGORY;
- }
-
- @Test
- public void testGetName() throws Exception {
- FilterKeyEnum testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
- @Test
- public void testGetAllFilters() throws Exception {
- List<String> result;
-
- // default test
- result = FilterKeyEnum.getAllFilters();
- }
-
- @Test
- public void testGetValidFiltersByAssetType() throws Exception {
- ComponentTypeEnum assetType = null;
- List<String> result;
-
- // default test
- result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.RESOURCE);
- result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.SERVICE);
- result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.SERVICE_INSTANCE);
- result = FilterKeyEnum.getValidFiltersByAssetType(assetType);
- }
+import org.junit.jupiter.api.Test;
+
+class FilterKeyEnumTest {
+
+ @Test
+ void testGetValidFiltersByAssetType() {
+ List<String> result;
+
+ result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.RESOURCE);
+ assertNotNull(result);
+ assertEquals(3, result.size());
+ assertTrue(result.contains(CATEGORY.getName()));
+ assertFalse(result.contains(VERSION.getName()));
+ result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.SERVICE);
+ assertNotNull(result);
+ assertEquals(4, result.size());
+ assertTrue(result.contains(CATEGORY.getName()));
+ assertFalse(result.contains(RESOURCE_TYPE.getName()));
+ result = FilterKeyEnum.getValidFiltersByAssetType(ComponentTypeEnum.SERVICE_INSTANCE);
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ result = FilterKeyEnum.getValidFiltersByAssetType(null);
+ assertNotNull(result);
+ assertEquals(0, result.size());
+ }
}