Fix Sonar Issues on policy-models-tosca
[policy/models.git] / models-tosca / src / test / java / org / onap / policy / models / tosca / authorative / provider / AuthorativeToscaProviderPolicyTypeTest.java
index 088e8e8..a322e06 100644 (file)
@@ -220,22 +220,19 @@ public class AuthorativeToscaProviderPolicyTypeTest {
                 ToscaEntityFilter.<ToscaPolicyType>builder().build());
 
         ToscaPolicyType gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName());
-        assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName()));
-        assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription()));
+        checkEqualsNameDescription(beforePolicyType, gotPolicyType);
 
         gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao,
                 ToscaEntityFilter.<ToscaPolicyType>builder().name(policyTypeKey.getName()).build());
 
         gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName());
-        assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName()));
-        assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription()));
+        checkEqualsNameDescription(beforePolicyType, gotPolicyType);
 
         gotServiceTemplate = new AuthorativeToscaProvider().getFilteredPolicyTypes(pfDao, ToscaEntityFilter
                 .<ToscaPolicyType>builder().name(policyTypeKey.getName()).version(VERSION_001).build());
 
         gotPolicyType = gotServiceTemplate.getPolicyTypes().get(policyTypeKey.getName());
-        assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName()));
-        assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription()));
+        checkEqualsNameDescription(beforePolicyType, gotPolicyType);
 
         List<ToscaPolicyType> gotPolicyTypeList =
                 new AuthorativeToscaProvider().getPolicyTypeList(pfDao, POLICY_NO_VERSION, VERSION_001);
@@ -263,6 +260,11 @@ public class AuthorativeToscaProviderPolicyTypeTest {
         assertEquals(true, beforePolicyType.getName().equals(gotPolicyType.getName()));
     }
 
+    private void checkEqualsNameDescription(ToscaPolicyType beforePolicyType, ToscaPolicyType gotPolicyType) {
+        assertEquals(beforePolicyType.getName(), gotPolicyType.getName());
+        assertEquals(0, ObjectUtils.compare(beforePolicyType.getDescription(), gotPolicyType.getDescription()));
+    }
+
     @Test
     public void testPolicyTypesCreate() throws Exception {
         assertThatThrownBy(() -> {