Add asserts where required, fix tiny issues.
Change-Id: I6a3fe8741a5659c9152b48d8d0bd19304ac9d94c
Issue-ID: SDC-2823
Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
import org.openecomp.sdc.be.user.UserBusinessLogic;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import org.openecomp.sdc.common.impl.ExternalConfiguration;
-import org.openecomp.sdc.common.impl.FSConfigurationSource;
import org.openecomp.sdc.exception.ResponseFormat;
import java.io.IOException;
import java.util.List;
import java.util.Map;
-import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
, any(String.class), eq(true))).thenReturn(Either.left(artifactDefinition));
when(artifactCassandraDao.saveArtifact(any())).thenReturn(CassandraOperationStatus.OK);
when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat());
- artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME,
+ Either<ArtifactDefinition, ResponseFormat> result = artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME,
USER, INSTANCE_ID, true, true);
+ assertThat(result.isLeft()).isTrue();
}
private ArtifactsBusinessLogic getArtifactsBusinessLogic() {
, any(String.class), eq(true))).thenReturn(Either.left(artifactDefinition));
when(artifactCassandraDao.saveArtifact(any())).thenReturn(CassandraOperationStatus.OK);
when(componentsUtils.getResponseFormat(any(ActionStatus.class))).thenReturn(new ResponseFormat());
- artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME,
+ Either<ArtifactDefinition, ResponseFormat> result = artifactBL.generateAndSaveHeatEnvArtifact(artifactDefinition, String.valueOf(PAYLOAD), ComponentTypeEnum.SERVICE, new Service(), RESOURCE_INSTANCE_NAME,
USER, INSTANCE_ID, true, false);
verify(janusGraphDao, times(1)).commit();
+ assertThat(result.isLeft()).isTrue();
}
@Test
result = artifactBL.handleDelete("parentId", "artifactId", USER, AuditingActionEnum.ARTIFACT_DELETE,
ComponentTypeEnum.RESOURCE, resource,
true, false);
- assertThat(result.isRight());
+ assertThat(result.isRight()).isTrue();
}
private void verifyHeatParam(HeatParameterDefinition heatEnvParam, HeatParameterDefinition heatYamlParam) {
import fj.data.Either;
import mockit.Deencapsulation;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
import org.junit.Before;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
private static final String RESOURCE_CATEGORY1 = "Network Layer 2-3";
private static final String RESOURCE_SUBCATEGORY = "Router";
public static final String RESOURCE_CATEGORY = "Network Layer 2-3/Router";
+ private static final String ARTIFACT_PLACEHOLDER_FILE_EXTENSION = "fileExtension";
public static final Resource resource = Mockito.mock(Resource.class);
@InjectMocks
.getConfiguration().getResourceDeploymentArtifacts();
Map<String, ArtifactTypeConfig> componentInstanceDeploymentArtifacts = ConfigurationManager
.getConfigurationManager().getConfiguration().getResourceInstanceDeploymentArtifacts();
- assertTrue(componentDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_POLL.getType()));
- assertTrue(componentDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_TRAP.getType()));
- assertTrue(componentInstanceDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_POLL.getType()));
- assertTrue(componentInstanceDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_TRAP.getType()));
+ assertThat(componentDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_POLL.getType())).isTrue();
+ assertThat(componentDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_TRAP.getType())).isTrue();
+ assertThat(componentInstanceDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_POLL.getType())).isTrue();
+ assertThat(componentInstanceDeploymentArtifacts.containsKey(ArtifactTypeEnum.SNMP_TRAP.getType())).isTrue();
}
@Test
when(toscaOperationFacade.getBySystemName(ComponentTypeEnum.SERVICE, serviceName)).thenReturn(getServiceRes);
byte[] downloadServiceArtifactByNamesRes = artifactBL
.downloadServiceArtifactByNames(serviceName, serviceVersion, artifactName);
- assertTrue(downloadServiceArtifactByNamesRes != null
- && downloadServiceArtifactByNamesRes.length == payload.length);
+ assertThat(downloadServiceArtifactByNamesRes != null
+ && downloadServiceArtifactByNamesRes.length == payload.length).isTrue();
}
@Test
result = Deencapsulation.invoke(testSubject, "validateUserRole",
new Object[]{user, auditingAction, componentId, artifactId, componentType,
operation});
+ assertNull(result);
}
@Test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "detectAuditingType",
new Object[]{operation, origMd5});
+ assertNotNull(result);
}
+ @Test
+ public void testDetectNoAuditingType() throws Exception {
+ ArtifactsBusinessLogic testSubject;
+ ArtifactsBusinessLogic arb = getTestSubject();
+ ArtifactOperationInfo operation = arb.new ArtifactOperationInfo(false, false, ArtifactOperationEnum.LINK);
+ String origMd5 = "";
+ AuditingActionEnum result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "detectAuditingType",
+ new Object[]{operation, origMd5});
+ assertNull(result);
+ }
@Test
public void testCreateEsArtifactData() throws Exception {
// default test
testSubject = createTestSubject();
result = testSubject.createEsArtifactData(artifactInfo, artifactPayload);
+ assertNotNull(result);
}
@Test
- public void testIsArtifactMetadataUpdate() throws Exception {
+ public void testIsArtifactMetadataUpdateTrue() throws Exception {
+ ArtifactsBusinessLogic testSubject;
+ AuditingActionEnum auditingActionEnum = AuditingActionEnum.ARTIFACT_METADATA_UPDATE;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "isArtifactMetadataUpdate",
+ new Object[]{auditingActionEnum});
+ assertThat(result).isTrue();
+ }
+
+ @Test
+ public void testIsArtifactMetadataUpdateFalse() throws Exception {
ArtifactsBusinessLogic testSubject;
AuditingActionEnum auditingActionEnum = AuditingActionEnum.ACTIVATE_SERVICE_BY_API;
boolean result;
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "isArtifactMetadataUpdate",
new Object[]{auditingActionEnum});
+ assertThat(result).isFalse();
}
@Test
- public void testIsDeploymentArtifact() throws Exception {
+ public void testIsDeploymentArtifactTrue() throws Exception {
ArtifactsBusinessLogic testSubject;
ArtifactDefinition artifactInfo = buildArtifactPayload();
+ artifactInfo.setArtifactGroupType(ArtifactGroupTypeEnum.DEPLOYMENT);
boolean result;
// default test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "isDeploymentArtifact", new Object[]{artifactInfo});
+ assertThat(result).isTrue();
}
+ @Test
+ public void testIsDeploymentArtifactFalse() throws Exception {
+ ArtifactsBusinessLogic testSubject;
+ ArtifactDefinition artifactInfo = buildArtifactPayload(); // artifactGroupType == ArtifactGroupTypeEnum.TOSCA
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = Deencapsulation.invoke(testSubject, "isDeploymentArtifact", new Object[]{artifactInfo});
+ assertThat(result).isFalse();
+ }
@Test
public void testSetArtifactPlaceholderCommonFields() throws Exception {
ArtifactsBusinessLogic testSubject;
- String resourceId = "";
+ String resourceId = ES_ARTIFACT_ID;
ArtifactDefinition artifactInfo = buildArtifactPayload();
testSubject = createTestSubject();
Deencapsulation.invoke(testSubject, "setArtifactPlaceholderCommonFields",
resourceId, user, artifactInfo);
-
+ assertEquals(resourceId + "." +ARTIFACT_LABEL, artifactInfo.getUniqueId());
+ assertEquals(user.getFullName(), artifactInfo.getCreatorFullName());
}
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "createEsHeatEnvArtifactDataFromString",
new Object[]{artifactDefinition, payloadStr});
+ assertThat(result.isLeft()).isTrue();
}
@Test
// test 1
testSubject = createTestSubject();
- testSubject.updateArtifactOnGroupInstance(component, instanceId, prevUUID, artifactInfo, artifactInfo);
+ result = testSubject.updateArtifactOnGroupInstance(component, instanceId, prevUUID, artifactInfo, artifactInfo);
+ assertThat(result.isLeft()).isTrue();
}
@Test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "generateHeatEnvPayload",
new Object[]{artifactDefinition});
+ assertThat(result.isEmpty()).isFalse();
}
// default test
testSubject = createTestSubject();
result = testSubject.buildJsonForUpdateArtifact(artifactInfo, artifactGroupType, updatedRequiredArtifacts);
+ assertThat(MapUtils.isNotEmpty(result)).isTrue();
}
@Test
artifactId = "";
result = testSubject.buildJsonForUpdateArtifact(artifactId, artifactName, artifactType, artifactGroupType,
label, displayName, description, artifactContent, updatedRequiredArtifacts, heatParameters);
+ assertThat(MapUtils.isNotEmpty(result)).isTrue();
}
@Test
- public void testReplaceCurrHeatValueWithUpdatedValue() throws Exception {
+ public void testNotReplaceCurrHeatValueWithUpdatedValue() throws Exception {
ArtifactsBusinessLogic testSubject;
List<HeatParameterDefinition> currentHeatEnvParams = new ArrayList<>();
List<HeatParameterDefinition> updatedHeatEnvParams = new ArrayList<>();
// default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "replaceCurrHeatValueWithUpdatedValue", new Object[]{currentHeatEnvParams, updatedHeatEnvParams});
+ boolean result = Deencapsulation.invoke(testSubject, "replaceCurrHeatValueWithUpdatedValue", new Object[]{currentHeatEnvParams, updatedHeatEnvParams});
+ assertThat(result).isFalse();
+ }
+
+
+ @Test
+ public void testReplaceCurrHeatValueWithUpdatedValue() throws Exception {
+ ArtifactsBusinessLogic testSubject;
+ HeatParameterDefinition hpdOrig = new HeatParameterDefinition();
+ hpdOrig.setName("param1");
+ hpdOrig.setCurrentValue("value1");
+
+ HeatParameterDefinition hpdUpd = new HeatParameterDefinition();
+ hpdUpd.setName("param1");
+ hpdUpd.setCurrentValue("value2");
+
+ List<HeatParameterDefinition> currentHeatEnvParams = new ArrayList<>();
+ currentHeatEnvParams.add(hpdOrig);
+
+ List<HeatParameterDefinition> updatedHeatEnvParams = new ArrayList<>();
+ updatedHeatEnvParams.add(hpdUpd);
+
+ // default test
+ testSubject = createTestSubject();
+ boolean result = Deencapsulation.invoke(testSubject, "replaceCurrHeatValueWithUpdatedValue", new Object[]{currentHeatEnvParams, updatedHeatEnvParams});
+ assertThat(result).isTrue();
+ assertEquals(hpdUpd.getCurrentValue(), hpdOrig.getCurrentValue());
}
// default test
testSubject = createTestSubject();
result = testSubject.extractArtifactDefinition(eitherArtifact);
+ assertNotNull(result);
+ assertEquals(artifactDefinition, result);
}
@Test
public void testSetHeatCurrentValuesOnHeatEnvDefaultValues() throws Exception {
ArtifactsBusinessLogic testSubject;
- ArtifactDefinition artifact = null;
- ArtifactDefinition artifactInfo = buildArtifactPayload();
+ ArtifactDefinition artifact = buildArtifactPayload();
+ ArtifactDefinition artifactInfo = new ArtifactDefinition();
+
+ HeatParameterDefinition hpdOrig = new HeatParameterDefinition();
+ hpdOrig.setName("param1");
+ hpdOrig.setCurrentValue("value1");
+ List<HeatParameterDefinition> currentHeatEnvParams = new ArrayList<>();
+ currentHeatEnvParams.add(hpdOrig);
+ artifact.setListHeatParameters(currentHeatEnvParams);
// default test
testSubject = createTestSubject();
Deencapsulation.invoke(testSubject, "setHeatCurrentValuesOnHeatEnvDefaultValues",
- artifactInfo, artifactInfo);
+ artifact, artifactInfo);
+
+ assertNotEquals(artifact, artifactInfo);
+ assertEquals(1, artifact.getListHeatParameters().size());
+ assertEquals(1, artifactInfo.getListHeatParameters().size());
+
+ String hpdOrigCurrValue = artifact.getListHeatParameters().get(0).getCurrentValue();
+ String hpdNewDefaultValue = artifactInfo.getListHeatParameters().get(0).getDefaultValue();
+
+ assertEquals(hpdOrigCurrValue, hpdNewDefaultValue);
}
@Test
- public void testBuildHeatEnvFileName() throws Exception {
+ public void testBuildHeatEnvFileNameArtifactNameNotNull() throws Exception {
+ String heatEnvExt = "zip";
ArtifactsBusinessLogic testSubject;
- ArtifactDefinition heatArtifact = null;
- ArtifactDefinition artifactInfo = buildArtifactPayload();
+ ArtifactDefinition heatArtifact = buildArtifactPayload();
+ ArtifactDefinition heatEnvArtifact = new ArtifactDefinition();
Map<String, Object> placeHolderData = new HashMap<>();
+ placeHolderData.put(ARTIFACT_PLACEHOLDER_FILE_EXTENSION, heatEnvExt);
+ String artName = ARTIFACT_NAME.split("\\.")[0];
+
+ // default test
+ testSubject = createTestSubject();
+ Deencapsulation.invoke(testSubject, "buildHeatEnvFileName", new Object[]{heatArtifact, heatEnvArtifact, placeHolderData});
+ assertThat(heatEnvArtifact.getArtifactName().startsWith(artName)).isTrue();
+ assertThat(heatEnvArtifact.getArtifactName().endsWith(heatEnvExt)).isTrue();
+ }
+ @Test
+ public void testBuildHeatEnvFileNameArtifactNameIsNull() throws Exception {
+ String heatEnvExt = "zip";
+ ArtifactsBusinessLogic testSubject;
+ ArtifactDefinition heatArtifact = buildArtifactPayload();
+ heatArtifact.setArtifactName(null);
+ ArtifactDefinition heatEnvArtifact = new ArtifactDefinition();
+ Map<String, Object> placeHolderData = new HashMap<>();
+ placeHolderData.put(ARTIFACT_PLACEHOLDER_FILE_EXTENSION, heatEnvExt);
// default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "buildHeatEnvFileName", new Object[]{artifactInfo, artifactInfo, placeHolderData});
+ Deencapsulation.invoke(testSubject, "buildHeatEnvFileName", new Object[]{heatArtifact, heatEnvArtifact, placeHolderData});
+ assertThat(heatEnvArtifact.getArtifactName().startsWith(ARTIFACT_LABEL)).isTrue();
+ assertThat(heatEnvArtifact.getArtifactName().endsWith(heatEnvExt)).isTrue();
}
@Test
public void testHandleEnvArtifactVersion() throws Exception {
ArtifactsBusinessLogic testSubject;
+ String existingVersion = "1.0";
ArtifactDefinition artifactInfo = buildArtifactPayload();
Map<String, String> existingEnvVersions = new HashMap<>();
-
+ existingEnvVersions.put(artifactInfo.getArtifactName(), existingVersion);
// test 1
testSubject = createTestSubject();
Deencapsulation.invoke(testSubject, "handleEnvArtifactVersion", artifactInfo, existingEnvVersions);
+ assertEquals(existingVersion, artifactInfo.getArtifactVersion());
}
@Test
testSubject = createTestSubject();
result = testSubject.handleArtifactsForInnerVfcComponent(artifactsToHandle, component, user,
vfcsNewCreatedArtifacts, operation, shouldLock, inTransaction);
+
+ assertThat(CollectionUtils.isEmpty(result)).isTrue();
}
@Test
public void testSetNodeTemplateOperation() throws Exception {
ArtifactsBusinessLogic testSubject;
- NodeTemplateOperation nodeTemplateOperation = null;
+ NodeTemplateOperation nodeTemplateOperation = new NodeTemplateOperation();
// default test
testSubject = createTestSubject();
- Deencapsulation.invoke(testSubject, "setNodeTemplateOperation", NodeTemplateOperation.class);
+ Deencapsulation.invoke(testSubject, "setNodeTemplateOperation", nodeTemplateOperation);
+ assertEquals(Deencapsulation.getField(testSubject, "nodeTemplateOperation"), nodeTemplateOperation);
}
@Test
, operationInfo, artifactDefinition.getUniqueId(), artifactDefinition, requestMd5, "data", "iuuid",
null, componentId, "resources");
- assertTrue(result.isLeft());
+ assertThat(result.isLeft()).isTrue();
ArtifactDefinition leftValue = result.left().value();
assertEquals(artifactDefinition.getArtifactName(), leftValue.getArtifactName());
}
componentInstance.setDeploymentArtifacts(deploymentArtifacts);
List<ArtifactDefinition> result = artifactBL.getDeploymentArtifacts(resource, parentType, ciId);
- Assert.assertTrue(result.size() == 1);
+ assertThat(result.size() == 1).isTrue();
Assert.assertEquals(artifactDefinition.getArtifactName(), result.get(0).getArtifactName());
}
import java.util.function.BiFunction;
import java.util.function.Function;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
ResponseFormat responseFormat = new ResponseFormat();
responseFormat.setServiceException(new ServiceException());
when(validator.apply(type1)).thenReturn(Either.right(responseFormat));
-
-
- commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+
+ Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
verify(janusGraphGenericDao).rollback();
+ assertThat(result.isRight()).isTrue();
}
- @Test
+ @Test(expected = RuntimeException.class)
public void testCreateElementTypesByDao_RuntTimeExceptionInValidation() {
Object type1 = new Object();
List<Object> elementTypesToCreate = Arrays.asList(type1);
when(elementInfoGetter.apply(type1)).thenReturn(elementInfo);
when(validator.apply(type1)).thenThrow(new RuntimeException("Test Exception"));
- try {
- commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
- }
- catch(Exception skip) {
- }
+ commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
responseFormat.setServiceException(new ServiceException());
when(componentsUtils.convertFromStorageResponseForCapabilityType(Mockito.any())).thenCallRealMethod();
when(componentsUtils.getResponseFormatByCapabilityType(ActionStatus.INVALID_CONTENT, type1)).thenReturn(responseFormat);
-
-
- commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+
+ Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
verify(janusGraphGenericDao).rollback();
+ assertThat(result.isRight()).isTrue();
}
@Test
when(componentsUtils.convertFromStorageResponseForCapabilityType(Mockito.any())).thenCallRealMethod();
when(componentsUtils.getResponseFormatByCapabilityType(ActionStatus.CAPABILITY_TYPE_ALREADY_EXIST, type1)).thenReturn(responseFormat);
-
- commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+ Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
verify(elementAdder).apply(type1);
verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
verify(janusGraphGenericDao).rollback();
+ assertThat(result.isRight()).isTrue();
}
when(componentsUtils.convertFromStorageResponseForCapabilityType(Mockito.any())).thenCallRealMethod();
when(componentsUtils.getResponseFormatByCapabilityType(ActionStatus.CAPABILITY_TYPE_ALREADY_EXIST, type1_1)).thenReturn(responseFormat);
-
- commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+ Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
verify(elementAdder, never()).apply(Mockito.any());
verify(elementUpgrader).apply(type1_1, type1);
verify(janusGraphGenericDao).rollback();
+ assertThat(result.isRight()).isTrue();
}
@Test
assertEquals(type1_1, result.left().value().get(0).getLeft());
assertEquals(false, result.left().value().get(0).getRight());
}
-
-
}
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anySet;
@Test
public void testIsCloudSpecificArtifact() {
- assertTrue(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_1));
- assertTrue(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_2));
- assertTrue(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_3));
- assertFalse(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_4));
- assertFalse(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_5));
+ assertThat(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_1)).isTrue();
+ assertThat(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_2)).isTrue();
+ assertThat(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_3)).isTrue();
+ assertThat(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_4)).isFalse();
+ assertThat(componentInstanceBusinessLogic.isCloudSpecificArtifact(ARTIFACT_5)).isFalse();
}
private void getforwardingPathOnVersionChange() {
.getRelationById(COMPONENT_ID,
RELATION_ID, USER_ID,
component.getComponentType());
- assertTrue(response.isLeft());
+ assertThat(response.isLeft()).isTrue();
}
private void getServiceRelationByIdUserValidationFailure(Component component) {
.getRelationById(COMPONENT_ID,
RELATION_ID, USER_ID,
component.getComponentType());
- assertTrue(response.isRight());
+ assertThat(response.isRight()).isTrue();
}
private void stubMethods() {
// default test
componentInstanceBusinessLogic = createTestSubject();
result = componentInstanceBusinessLogic.changeServiceProxyVersion();
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = testSubject.createServiceProxy();
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = testSubject.deleteServiceProxy();
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = testSubject.getComponentInstanceInputsByInputId(component, inputId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = testSubject.getComponentInstancePropertiesByInputId(component, inputId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = testSubject.getRelationById(componentId, relationId, userId, componentTypeEnum);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "validateParent", new Object[]{resource, nodeTemplateId});
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "getComponentType", new Object[]{ComponentTypeEnum.class});
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "getNewGroupName",
new Object[]{oldPrefix, newNormailzedPrefix, qualifiedGroupInstanceName});
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
testSubject = createTestSubject();
result = Deencapsulation
.invoke(testSubject, "updateComponentInstanceMetadata", new Object[]{toInstance, toInstance});
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
result = testSubject
.createOrUpdatePropertiesValues(componentTypeEnum, componentId, resourceInstanceId, properties,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
componentTypeEnum = null;
result = testSubject
.createOrUpdatePropertiesValues(componentTypeEnum, componentId, resourceInstanceId, properties,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
result = testSubject
.createOrUpdatePropertiesValues(componentTypeEnum, componentId, resourceInstanceId, properties,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
result = testSubject
.createOrUpdateInstanceInputValues(componentTypeEnum, componentId, resourceInstanceId, inputs,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
componentTypeEnum = null;
result = testSubject
.createOrUpdateInstanceInputValues(componentTypeEnum, componentId, resourceInstanceId, inputs,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
result = testSubject
.createOrUpdateInstanceInputValues(componentTypeEnum, componentId, resourceInstanceId, inputs,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
result = testSubject
.createOrUpdateGroupInstancePropertyValue(componentTypeEnum, componentId, resourceInstanceId,
groupInstanceId, property, userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
componentTypeEnum = null;
result = testSubject
.createOrUpdateGroupInstancePropertyValue(componentTypeEnum, componentId, resourceInstanceId,
groupInstanceId, property, userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
result = testSubject
.createOrUpdateGroupInstancePropertyValue(componentTypeEnum, componentId, resourceInstanceId,
groupInstanceId, property, userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
testSubject = createTestSubject();
result = testSubject.deletePropertyValue(componentTypeEnum, serviceId, resourceInstanceId, propertyValueId,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
componentTypeEnum = null;
result = testSubject.deletePropertyValue(componentTypeEnum, serviceId, resourceInstanceId, propertyValueId,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
result = testSubject.deletePropertyValue(componentTypeEnum, serviceId, resourceInstanceId, propertyValueId,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "getComponentParametersViewForForwardingPath");
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
// default test
testSubject = createTestSubject();
result = Deencapsulation.invoke(testSubject, "getResourceInstanceById", new Object[]{resource, instanceId});
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
testSubject = createTestSubject();
result = testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId,
componentInstanceUniqueId, capabilityType, capabilityName, properties, userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
when(toscaOperationFacade.getToscaFullElement(containerComponentId)).thenReturn(Either.left(resource));
result = testSubject.updateInstanceCapabilityProperties(componentTypeEnum, containerComponentId,
componentInstanceUniqueId, capabilityType, capabilityName, properties, userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
}
@Test
result = componentInstanceBusinessLogic
.copyComponentInstance(inputComponentInstance, containerComponentId, componentInstanceId,
USER_ID);
- Assert.assertNotNull(result);
+ assertNotNull(result);
service.setLastUpdaterUserId(oldLastUpdatedUserId);
- assertThat(result.isRight());
+ assertThat(result.isRight()).isTrue();
}
@Test
Either<Component, StorageOperationStatus> getComponentRes = Either.left(resource);
result = componentInstanceBusinessLogic
.copyComponentInstance(inputComponentInstance, containerComponentId, componentInstanceId, USER_ID);
- Assert.assertNotNull(result);
+ assertNotNull(result);
service.setLastUpdaterUserId(oldServiceLastUpdatedUserId);
- assertThat(result.isRight());
+ assertThat(result.isRight()).isTrue();
}
@Test
result = componentInstanceBusinessLogic
.copyComponentInstance(inputComponentInstance, containerComponentId, componentInstanceId,
USER_ID);
- Assert.assertNotNull(result);
+ assertNotNull(result);
service.setLastUpdaterUserId(oldServiceLastUpdatedUserId);
resource.setLifecycleState(oldResourceLifeCycle);
.getUniqueId(),
toInstance.getUniqueId(), attribute,
USER_ID);
- Assert.assertNotNull(result);
+ assertNotNull(result);
service.setLastUpdaterUserId(oldLastUpdatedUserId);
service.setLifecycleState(oldLifeCycleState);
- assertTrue(result.isLeft());
+ assertThat(result.isLeft()).isTrue();
ComponentInstanceProperty resultProp = result.left().value();
assertEquals(resultProp.getPath().size(), 1);
assertEquals(resultProp.getPath().get(0), toInstance.getUniqueId());
Either<String, ResponseFormat> result = Deencapsulation.invoke(componentInstanceBusinessLogic,
"updateComponentInstanceProperty", containerComponentId, componentInstanceId, property);
- Assert.assertNotNull(result);
- assertTrue(result.isLeft());
+ assertNotNull(result);
+ assertThat(result.isLeft()).isTrue();
}
@Test
result = componentInstanceBusinessLogic
.batchDeleteComponentInstance(containerComponentParam, containerComponentId, componentInstanceIdList,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
assertEquals(deleteErrorMap, result);
} catch (ComponentException e) {
assertEquals(e.getActionStatus().toString(), StorageOperationStatus.GENERAL_ERROR.toString());
result = componentInstanceBusinessLogic
.batchDeleteComponentInstance(containerComponentParam, containerComponentId, componentInstanceIdList,
userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
assertEquals(deleteErrorMap, result);
} catch (ComponentException e) {
assertEquals(e.getActionStatus().toString(), StorageOperationStatus.GENERAL_ERROR.toString());
result = componentInstanceBusinessLogic
.batchDeleteComponentInstance(containerComponentParam, containerComponentId,
componentInstanceIdList, userId);
- Assert.assertNotNull(result);
+ assertNotNull(result);
service.setLastUpdaterUserId(oldLastUpdatedUserId);
service.setLifecycleState(oldLifeCycleState);
try {
result = componentInstanceBusinessLogic
.batchDissociateRIFromRI(componentId, userId, requirementDefList, componentTypeEnum);
- Assert.assertNotNull(result);
+ assertNotNull(result);
assertEquals(new ArrayList<>(), result);
} catch (ComponentException e) {
assertEquals(e.getActionStatus().toString(), StorageOperationStatus.GENERAL_ERROR.toString());
result = componentInstanceBusinessLogic
.batchDissociateRIFromRI(componentId, userId, requirementDefList, componentTypeEnum);
- Assert.assertNotNull(result);
+ assertNotNull(result);
service.setLastUpdaterUserId(oldLastUpdatedUserId);
service.setLifecycleState(oldLifeCycleState);
Optional<ComponentInstanceProperty> propertyCandidate =
getComponentInstanceProperty(PROP_NAME);
- Assert.assertTrue(propertyCandidate.isPresent());
- Assert.assertEquals(propertyCandidate.get().getName(), PROP_NAME);
+ assertThat(propertyCandidate.isPresent()).isTrue();
+ assertEquals(propertyCandidate.get().getName(), PROP_NAME);
}
@Test
Optional<ComponentInstanceProperty> propertyCandidate =
getComponentInstanceProperty(NON_EXIST_NAME);
- Assert.assertEquals(propertyCandidate, Optional.empty());
+ assertEquals(propertyCandidate, Optional.empty());
}
private Optional<ComponentInstanceProperty> getComponentInstanceProperty(String propertyName) {
groupDefinitions.add(groupDefinition);
when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
result = test.createGroups(component, groupDefinitions, true);
- Assert.assertTrue(result.isRight());
+ assertThat(result.isRight()).isTrue();
}
@Test
when(groupsOperation.createGroups(any(Component.class), anyMap())).thenReturn(Either.left(groupDefinitions));
when(groupsOperation.addCalculatedCapabilitiesWithProperties(anyString(), anyMap(), anyMap())).thenReturn(StorageOperationStatus.OK);
result = test.createGroups(component, groupDefinitions, true);
- Assert.assertTrue(result.isLeft());
+ assertThat(result.isLeft()).isTrue();
}
@Test
groupDefinitions.add(groupDefinition);
result = test.validateUpdateVfGroupNamesOnGraph(groupDefinitions, component);
- Assert.assertTrue(result.isLeft());
+ assertThat(result.isLeft()).isTrue();
}
@Test
when(groupsOperation.addGroups(any(Resource.class), any())).thenReturn(Either.left(groupDefList));
when(groupsOperation.addCalculatedCapabilitiesWithProperties(anyString(), anyMap(), anyMap())).thenReturn(StorageOperationStatus.OK);
result = test.createGroup(componentId, compTypeEnum, grpType, userId);
- assertThat(result.getClass().isInstance(GroupDefinition.class));
+ assertThat(result.getClass()).isAssignableFrom(GroupDefinition.class);
}
private PropertyDefinition buildProperty(String name, String defaultValue, String description) {
import java.util.Optional;
import java.util.stream.Collectors;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyMap;
public void getComponentInstanceInputs_ComponentInstanceNotExist() {
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(Either.left(service));
Either<List<ComponentInstanceInput>, ResponseFormat> componentInstanceInputs = testInstance.getComponentInstanceInputs(USER_ID, COMPONENT_ID, "nonExisting");
- assertTrue(componentInstanceInputs.isRight());
+ assertThat(componentInstanceInputs.isRight()).isTrue();
verify(componentsUtilsMock).getResponseFormat(ActionStatus.COMPONENT_INSTANCE_NOT_FOUND);
}
Component component = new Resource();
when(toscaOperationFacadeMock.getToscaElement(any(String.class), any(ComponentParametersView.class))).thenReturn(Either.left(component));
testInstance.getInputs(userId, componentId);
- assertEquals(null, component.getInputs());
+ assertNull(component.getInputs());
}
@Test
component.setInputs(listDef);
when(toscaOperationFacadeMock.getToscaElement(any(String.class), any(ComponentParametersView.class))).thenReturn(Either.left(component));
result = testInstance.getComponentInstancePropertiesByInputId(userId, componentId, componentId, componentId);
- assertTrue(result.isLeft());
+ assertThat(result.isLeft()).isTrue();
}
@Test
Either<List<InputDefinition>, ResponseFormat> declaredPropertiesEither =
testInstance.declareProperties(USER_ID, COMPONENT_ID, ComponentTypeEnum.SERVICE, componentInstInputsMap);
- assertTrue(declaredPropertiesEither.isLeft());
+ assertThat(declaredPropertiesEither.isLeft()).isTrue();
List<InputDefinition> declaredProperties = declaredPropertiesEither.left().value();
- assertTrue(CollectionUtils.isNotEmpty(declaredProperties));
+ assertThat(CollectionUtils.isNotEmpty(declaredProperties)).isTrue();
assertEquals(1, declaredProperties.size());
assertEquals(declaredProperties, declaredPropertiesToInputs);
}
when(componentsUtilsMock.convertFromStorageResponse(StorageOperationStatus.ARTIFACT_NOT_FOUND)).thenReturn(ActionStatus.ARTIFACT_NOT_FOUND);
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
Either<List<InputDefinition>, ResponseFormat> responseFormatEither = testInstance.getInputs("USR01", COMPONENT_ID);
- assertEquals(true,responseFormatEither.isRight());
+ assertThat(responseFormatEither.isRight()).isTrue();
}
component.setInputs(inputlist);
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
Either<List<ComponentInstanceProperty>, ResponseFormat> responseFormatEither = testInstance.getComponentInstancePropertiesByInputId("USR01", COMPONENT_ID,"INST0.1", "INPO1");
- assertEquals(true,responseFormatEither.isRight());
+ assertThat(responseFormatEither.isRight()).isTrue();
}
@Test
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(Either.left(component));
when(toscaOperationFacadeMock.getToscaElement(eq("RES0.1"), any(ComponentParametersView.class))).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
Either<List<ComponentInstanceProperty>, ResponseFormat> responseFormatEither = testInstance.getComponentInstancePropertiesByInputId("USR01", COMPONENT_ID,"INST0.1", "INPO1");
- assertEquals(true,responseFormatEither.isRight());
+ assertThat(responseFormatEither.isRight()).isTrue();
}
@Test
{
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND));
Either<List<ComponentInstanceInput>, ResponseFormat> result = testInstance.getInputsForComponentInput("USR01", COMPONENT_ID,"INPO1");
- assertEquals(true,result.isRight());
+ assertThat(result.isRight()).isTrue();
}
@Test
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), any(ComponentParametersView.class))).thenReturn(Either.left(component));
when(componentInstanceBusinessLogic.getComponentInstancePropertiesByInputId(any(Component.class),eq("INPO1"))).thenReturn(compinstancelist);
Either<List<ComponentInstanceInput>, ResponseFormat> result = testInstance.getInputsForComponentInput("USR01", COMPONENT_ID,"INPO1");
- assertEquals(true,result.isLeft());
+ assertThat(result.isLeft()).isTrue();
}
private List<ComponentInstancePropInput> getPropertiesListForDeclaration() {
Either<List<InputDefinition>, ResponseFormat> result =
testInstance.createListInput(USER_ID, COMPONENT_ID, ComponentTypeEnum.SERVICE, createListInputParams, true, false);
// validate result
- assertEquals(true, result.isLeft());
+ assertThat(result.isLeft()).isTrue();
List<InputDefinition> resultInputList = result.left().value();
assertEquals(1, resultInputList.size());
//InputDefinition resultInput = resultInputList.get(0);
Map<String, DataTypeDefinition> captoredDataTypeMap = dataTypesMapCaptor.getValue();
assertEquals(1, captoredDataTypeMap.size());
- assertEquals(true, captoredDataTypeMap.containsKey(LISTINPUT_SCHEMA_TYPE));
+ assertThat(captoredDataTypeMap.containsKey(LISTINPUT_SCHEMA_TYPE)).isTrue();
DataTypeDefinition captoredDataType = captoredDataTypeMap.get(LISTINPUT_SCHEMA_TYPE);
assertEquals("tosca.datatypes.Root", captoredDataType.getDerivedFromName());
assertEquals( propInputsList.size(), captoredDataType.getProperties().size());
captoredDataType.getProperties().forEach(dataTypeProp -> {
Optional<ComponentInstancePropInput> find = propInputsList.stream()
.filter(propInput -> propInput.getName().equals(dataTypeProp.getName())).findAny();
- assertEquals(true, find.isPresent());
+ assertThat(find.isPresent()).isTrue();
});
}
Either<List<InputDefinition>, ResponseFormat> result =
testInstance.createListInput(USER_ID, COMPONENT_ID, ComponentTypeEnum.SERVICE, createListInputParams, true, false);
- assertEquals(true, result.isRight());
+ assertThat(result.isRight()).isTrue();
verify(propertyOperation, times(1)).isPropertyTypeValid(any());
}
Either<List<InputDefinition>, ResponseFormat> result =
testInstance.createListInput(USER_ID, COMPONENT_ID, ComponentTypeEnum.SERVICE, createListInputParams, true, false);
- assertEquals(true, result.isRight());
+ assertThat(result.isRight()).isTrue();
verify(toscaOperationFacadeMock, times(1)).addInputsToComponent(anyMap(), eq(COMPONENT_ID));
}
import fj.data.Either;
import java.util.ArrayList;
-import java.util.Optional;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Before;
import org.junit.BeforeClass;
import static org.assertj.core.api.Java6Assertions.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyMap;
-import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
when(toscaOperationFacade.associatePolicyToComponent(eq(COMPONENT_ID), any(PolicyDefinition.class), eq(0))).thenReturn(policySuccessEither);
stubUnlockAndCommit();
PolicyDefinition response = businessLogic.createPolicy(ComponentTypeEnum.RESOURCE, COMPONENT_ID, POLICY_TYPE_NAME, USER_ID, true);
- assertTrue(!response.isEmpty());
+ assertThat(response.isEmpty()).isFalse();
}
@Test
Map<String, PolicyDefinition> createdPolicy = businessLogic.createPoliciesFromParsedCsar(newResource, policies);
- assertFalse(createdPolicy.isEmpty());
+ assertThat(createdPolicy.isEmpty()).isFalse();
PolicyDefinition newPolicy = createdPolicy.get(POLICY_NAME);
assertNotNull(newPolicy);
assertNotNull(newPolicy.getTargets());
}
private void assertNotFound(Either<PolicyDefinition, ResponseFormat> response) {
- assertTrue(response.isRight() && response.right().value().getStatus().equals(404));
+ assertThat(response.isRight() && response.right().value().getStatus().equals(404)).isTrue();
}
@Test(expected = ComponentException.class)
when(toscaOperationFacade.updatePolicyOfComponent(eq(COMPONENT_ID), any(PolicyDefinition.class), any(PromoteVersionEnum.class))).thenReturn(policySuccessEither);
stubUnlockAndCommit();
PolicyDefinition response = businessLogic.updatePolicy(ComponentTypeEnum.RESOURCE, COMPONENT_ID, otherPolicy, USER_ID, true);
- assertTrue(!response.isEmpty());
+ assertThat(response.isEmpty()).isFalse();
}
@Test(expected = ComponentException.class)
stubValidationSuccess(CREATE_POLICY);
stubCommit();
PolicyDefinition response = businessLogic.getPolicy(ComponentTypeEnum.RESOURCE, COMPONENT_ID, POLICY_ID, USER_ID);
- assertTrue(!response.isEmpty());
+ assertThat(response.isEmpty()).isFalse();
}
@Test(expected = ComponentException.class)
stubCommit();
when(toscaOperationFacade.removePolicyFromComponent(eq(COMPONENT_ID),eq(POLICY_ID))).thenReturn(StorageOperationStatus.OK);
PolicyDefinition response = businessLogic.deletePolicy(ComponentTypeEnum.RESOURCE, COMPONENT_ID, POLICY_ID, USER_ID, true);
- assertTrue(!response.isEmpty());
+ assertThat(response.isEmpty()).isFalse();
}
@Test(expected = ComponentException.class)
ComponentTypeEnum.RESOURCE,
getInputForPropertyToPolicyDeclaration());
- assertTrue(declaredPoliciesEither.isLeft());
+ assertThat(declaredPoliciesEither.isLeft()).isTrue();
List<PolicyDefinition> declaredPolicies = declaredPoliciesEither.left().value();
- assertTrue(CollectionUtils.isNotEmpty(declaredPolicies));
+ assertThat(CollectionUtils.isNotEmpty(declaredPolicies)).isTrue();
assertEquals(1, declaredPolicies.size());
}