aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentsUtilsTest.java
blob: a9245d28974e46be0c07c2e0bcc9e4e63bdd309f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
package org.openecomp.sdc.be.components.impl;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.auditing.api.AuditEventFactory;
import org.openecomp.sdc.be.auditing.impl.AuditBaseEventFactory;
import org.openecomp.sdc.be.auditing.impl.AuditingManager;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.LifecycleStateEnum;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum;
import org.openecomp.sdc.be.resources.data.auditing.DistributionDownloadEvent;
import org.openecomp.sdc.be.resources.data.auditing.EcompOperationalEnvironmentEvent;
import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent;
import org.openecomp.sdc.be.resources.data.auditing.UserAdminEvent;
import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData;
import org.openecomp.sdc.be.resources.data.auditing.model.ResourceAuditData;
import org.openecomp.sdc.common.util.ThreadLocalsHolder;
import org.openecomp.sdc.exception.ResponseFormat;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.ARTIFACT_DATA;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.ARTIFACT_UUID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.COMMENT;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.CURRENT_STATE;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.CURRENT_VERSION;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DCURR_STATUS;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESCRIPTION;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DESC_ERROR;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DIST_CONSUMER_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DIST_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DIST_RESOURCE_URL;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.DPREV_STATUS;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.INVARIANT_UUID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_FIRST_NAME;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_LAST_NAME;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.MODIFIER_UID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_ACTION;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_NAME;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.OP_ENV_TYPE;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.PREV_RESOURCE_STATE;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.PREV_RESOURCE_VERSION;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.REQUEST_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.RESOURCE_NAME;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.SERVICE_INSTANCE_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_500;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.STATUS_OK;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.TENANT_CONTEXT;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.TESTER_USER_ROLE;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.TOSCA_NODE_TYPE;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.UPDATED_USER_EXTENDED_NAME;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_EMAIL;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_FIRST_NAME;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_ID;
import static org.openecomp.sdc.be.auditing.impl.AuditTestUtils.USER_LAST_NAME;

@RunWith(MockitoJUnitRunner.class)
public class ComponentsUtilsTest {

    private static User modifier = new User();
    private Component service = new Service();
    private Resource resource = new Resource();

    @Mock
    private AuditingManager manager;

    @Mock
    private ResponseFormat responseFormat;

    @Captor
    private ArgumentCaptor<AuditBaseEventFactory> factoryCaptor;

    @InjectMocks
    private static ComponentsUtils utils;

    @BeforeClass
    public static void setUpClass() {
        modifier.setFirstName(MODIFIER_FIRST_NAME);
        modifier.setLastName(MODIFIER_LAST_NAME);
        modifier.setUserId(MODIFIER_ID);
    }


    @Before
    public void setUp() {
        ThreadLocalsHolder.setUuid(REQUEST_ID);
        utils = new ComponentsUtils(manager);
    }

    @Test
    public void auditComponentWhenAllParamsPassed() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_OK));
        when(responseFormat.getFormattedMessage()).thenReturn(DESCRIPTION);
        service.setUUID(SERVICE_INSTANCE_ID);
        service.setInvariantUUID(INVARIANT_UUID);

        utils.auditComponent(responseFormat, modifier, service, AuditingActionEnum.ARTIFACT_DELETE, service.getComponentType(),
                ResourceAuditData.newBuilder()
                        .state(PREV_RESOURCE_STATE)
                        .version(PREV_RESOURCE_VERSION)
                        .artifactUuid(ARTIFACT_UUID)
                        .distributionStatus(DPREV_STATUS).build(),
                ResourceAuditData.newBuilder()
                        .state(CURRENT_STATE)
                        .version(CURRENT_VERSION)
                        .artifactUuid(ARTIFACT_UUID)
                        .distributionStatus(DCURR_STATUS).build(),
                RESOURCE_NAME, COMMENT, ARTIFACT_DATA, DIST_ID);
        verifyResourceAdminEvent(AuditingActionEnum.ARTIFACT_DELETE.getName(), STATUS_OK, DESCRIPTION, service.getComponentType().getValue(),
                false, true, true, true, true, true);
    }

    @Test
    public void auditComponentWhenAllParamsPassedAndMostFromComponent() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_OK));
        when(responseFormat.getFormattedMessage()).thenReturn(DESCRIPTION);

        service.setUUID(SERVICE_INSTANCE_ID);
        service.setInvariantUUID(INVARIANT_UUID);
        service.setState(LifecycleStateEnum.CERTIFIED);
        service.setVersion(CURRENT_VERSION);
        utils.auditComponent(responseFormat, modifier, service, AuditingActionEnum.CREATE_RESOURCE, service.getComponentType(),
                ResourceAuditData.newBuilder()
                        .state(PREV_RESOURCE_STATE)
                        .version(PREV_RESOURCE_VERSION)
                        .artifactUuid(ARTIFACT_UUID)
                        .distributionStatus(DPREV_STATUS).build(),
                ResourceAuditData.newBuilder()
                        .artifactUuid(ARTIFACT_UUID)
                        .distributionStatus(DCURR_STATUS).build(),
                RESOURCE_NAME, COMMENT, ARTIFACT_DATA, DIST_ID);
        verifyResourceAdminEvent(AuditingActionEnum.CREATE_RESOURCE.getName(), STATUS_OK, DESCRIPTION, service.getComponentType().getValue(),
                false, true, true, true, true, true);

    }

    @Test
    public void auditComponentDistStateWithoutArtDataCommentAndDid() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_OK));
        when(responseFormat.getFormattedMessage()).thenReturn(DESCRIPTION);

        service.setUUID(SERVICE_INSTANCE_ID);
        service.setInvariantUUID(INVARIANT_UUID);
        service.setState(LifecycleStateEnum.CERTIFIED);
        service.setName(RESOURCE_NAME);
        service.setVersion(CURRENT_VERSION);
        utils.auditComponent(responseFormat, modifier, service, AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REQUEST, service.getComponentType(),
                ResourceAuditData.newBuilder()
                        .state(PREV_RESOURCE_STATE)
                        .version(PREV_RESOURCE_VERSION)
                        .artifactUuid(ARTIFACT_UUID)
                        .distributionStatus(DPREV_STATUS).build(),
                ResourceAuditData.newBuilder()
                        .artifactUuid(ARTIFACT_UUID)
                        .distributionStatus(DCURR_STATUS).build());
        verifyResourceAdminEvent(AuditingActionEnum.DISTRIBUTION_STATE_CHANGE_REQUEST.getName(),
                STATUS_OK, DESCRIPTION, service.getComponentType().getValue(),
                false, true, true, false, false, true);
    }

    @Test
    public void auditComponentWhenError() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_500));
        when(responseFormat.getFormattedMessage()).thenReturn(DESC_ERROR);

        service.setUUID(SERVICE_INSTANCE_ID);
        service.setInvariantUUID(INVARIANT_UUID);
        service.setState(LifecycleStateEnum.CERTIFIED);
        service.setName(RESOURCE_NAME);
        service.setVersion(CURRENT_VERSION);

        utils.auditComponent(responseFormat, modifier, service, AuditingActionEnum.CERTIFICATION_REQUEST_RESOURCE,
                ComponentTypeEnum.SERVICE,
                ResourceAuditData.newBuilder().state(PREV_RESOURCE_STATE).version(PREV_RESOURCE_VERSION).artifactUuid(ARTIFACT_UUID).build());
        verifyResourceAdminEvent(AuditingActionEnum.CERTIFICATION_REQUEST_RESOURCE.getName(), STATUS_500, DESC_ERROR,
                service.getComponentType().getValue(), false, true, false, false, false, false);
    }

    @Test
    public void auditComponentWhenCompIsNull() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_500));
        when(responseFormat.getFormattedMessage()).thenReturn(DESC_ERROR);

        utils.auditComponent(responseFormat, modifier, AuditingActionEnum.START_CERTIFICATION_RESOURCE,
                RESOURCE_NAME, ComponentTypeEnum.SERVICE, COMMENT);
        verifyResourceAdminEvent(AuditingActionEnum.START_CERTIFICATION_RESOURCE.getName(), STATUS_500, DESC_ERROR, service.getComponentType().getValue(),
                true, false, false, false, true, false);
    }

    @Test
    public void auditComponentAdmin() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_500));
        when(responseFormat.getFormattedMessage()).thenReturn(DESC_ERROR);

        service.setUUID(SERVICE_INSTANCE_ID);
        service.setInvariantUUID(INVARIANT_UUID);
        service.setName(RESOURCE_NAME);
        service.setState(LifecycleStateEnum.CERTIFIED);
        service.setVersion(CURRENT_VERSION);
        utils.auditComponentAdmin(responseFormat, modifier, service, AuditingActionEnum.CREATE_RESOURCE, service.getComponentType());
        verifyResourceAdminEvent(AuditingActionEnum.CREATE_RESOURCE.getName(), STATUS_500, DESC_ERROR, service.getComponentType().getValue(),
                false, false, false, false, false, false);
    }

    @Test
    public void auditResourceWhenAllParamsPassed() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_OK));
        when(responseFormat.getFormattedMessage()).thenReturn(DESCRIPTION);

        resource.setUUID(SERVICE_INSTANCE_ID);
        resource.setInvariantUUID(INVARIANT_UUID);
        resource.setName(RESOURCE_NAME);
        resource.setLifecycleState(LifecycleStateEnum.CERTIFIED);
        resource.setVersion(CURRENT_VERSION);
        resource.setToscaResourceName(TOSCA_NODE_TYPE);
        utils.auditResource(responseFormat, modifier, resource, null, AuditingActionEnum.IMPORT_RESOURCE,
                ResourceAuditData.newBuilder()
                        .state(PREV_RESOURCE_STATE)
                        .version(PREV_RESOURCE_VERSION)
                        .artifactUuid(ARTIFACT_UUID)
                        .build(),
                ARTIFACT_UUID, ARTIFACT_DATA);
        verifyResourceAdminEvent(AuditingActionEnum.IMPORT_RESOURCE.getName(), STATUS_OK, DESCRIPTION, resource.getResourceType().name(),
                false, true, true, true, false, false);
    }

    @Test
    public void auditResourceWithoutPrevFields() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_500));
        when(responseFormat.getFormattedMessage()).thenReturn(DESC_ERROR);

        resource.setUUID(SERVICE_INSTANCE_ID);
        resource.setInvariantUUID(INVARIANT_UUID);
        resource.setName(RESOURCE_NAME);
        resource.setLifecycleState(LifecycleStateEnum.CERTIFIED);
        resource.setVersion(CURRENT_VERSION);

        utils.auditResource(responseFormat, modifier, resource, AuditingActionEnum.UPDATE_RESOURCE_METADATA);
        verifyResourceAdminEvent(AuditingActionEnum.UPDATE_RESOURCE_METADATA.getName(), STATUS_500, DESC_ERROR, resource.getResourceType().name(),
                false, false, false, false, false, false);
    }

    @Test
    public void auditResourceWhenResourceIsNull() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_500));
        when(responseFormat.getFormattedMessage()).thenReturn(DESC_ERROR);

        utils.auditResource(responseFormat, modifier, RESOURCE_NAME, AuditingActionEnum.CHECKOUT_RESOURCE);
        verifyResourceAdminEvent(AuditingActionEnum.CHECKOUT_RESOURCE.getName(), STATUS_500, DESC_ERROR, ComponentTypeEnum.RESOURCE.getValue(),
                true, false, false, false, false, false);
    }

    @Test
    public void auditUserAdminEvent() {
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_OK));
        when(responseFormat.getFormattedMessage()).thenReturn(DESCRIPTION);

        User userAfter = new User();
        userAfter.setFirstName(USER_FIRST_NAME);
        userAfter.setUserId(USER_ID);
        userAfter.setLastName(USER_LAST_NAME);
        userAfter.setRole(TESTER_USER_ROLE);
        userAfter.setEmail(USER_EMAIL);

        utils.auditAdminUserAction(AuditingActionEnum.ADD_USER, modifier, null, userAfter, responseFormat);
        verify(manager).auditEvent(factoryCaptor.capture());
        AuditEventFactory factory = factoryCaptor.getValue();
        UserAdminEvent event = (UserAdminEvent)factory.getDbEvent();
        assertThat(event.getModifier()).isEqualTo(MODIFIER_UID);
        assertThat(event.getStatus()).isEqualTo(STATUS_OK);
        assertThat(event.getDesc()).isEqualTo(DESCRIPTION);
        assertThat(event.getRequestId()).isEqualTo(REQUEST_ID);
        assertThat(event.getAction()).isEqualTo(AuditingActionEnum.ADD_USER.getName());
        assertThat(event.getUserBefore()).isNull();
        assertThat(event.getUserAfter()).isEqualTo(UPDATED_USER_EXTENDED_NAME);
    }

    @Test
    public void auditEcompOpEnvEvent() {
        utils.auditEnvironmentEngine(AuditingActionEnum.CREATE_ENVIRONMENT, OP_ENV_ID, OP_ENV_TYPE, OP_ENV_ACTION, OP_ENV_NAME, TENANT_CONTEXT);
        verify(manager).auditEvent(factoryCaptor.capture());
        AuditEventFactory factory = factoryCaptor.getValue();
        EcompOperationalEnvironmentEvent event = (EcompOperationalEnvironmentEvent)factory.getDbEvent();
        assertThat(event.getAction()).isEqualTo(AuditingActionEnum.CREATE_ENVIRONMENT.getName());
        assertThat(event.getOperationalEnvironmentId()).isEqualTo(OP_ENV_ID);
        assertThat(event.getOperationalEnvironmentType()).isEqualTo(OP_ENV_TYPE);
        assertThat(event.getOperationalEnvironmentName()).isEqualTo(OP_ENV_NAME);
        assertThat(event.getOperationalEnvironmentAction()).isEqualTo(OP_ENV_ACTION);
        assertThat(event.getTenantContext()).isEqualTo(TENANT_CONTEXT);
    }

    @Test
    public void auditDistrDownloadEvent(){
        when(responseFormat.getStatus()).thenReturn(Integer.valueOf(STATUS_OK));
        when(responseFormat.getFormattedMessage()).thenReturn(DESCRIPTION);

        utils.auditDistributionDownload(responseFormat, new DistributionData(DIST_CONSUMER_ID, DIST_RESOURCE_URL));

        verify(manager).auditEvent(factoryCaptor.capture());
        AuditEventFactory factory = factoryCaptor.getValue();
        DistributionDownloadEvent event = (DistributionDownloadEvent)factory.getDbEvent();
        assertThat(event.getResourceUrl()).isEqualTo(DIST_RESOURCE_URL);
        assertThat(event.getConsumerId()).isEqualTo(DIST_CONSUMER_ID);
        assertThat(event.getStatus()).isEqualTo(STATUS_OK);
        assertThat(event.getDesc()).isEqualTo(DESCRIPTION);
        assertThat(event.getRequestId()).isEqualTo(REQUEST_ID);
        assertThat(event.getAction()).isEqualTo(AuditingActionEnum.DISTRIBUTION_ARTIFACT_DOWNLOAD.getName());
    }

    private void verifyResourceAdminEvent(String action, String status, String desc, String resourceType, boolean isComponentNull,
            boolean isPrevStateAndVersionSet, boolean isCurrFieldsProvided, boolean isArtDataProvided, boolean isCommentProvided,
            boolean isDistStatusProvided) {
        verify(manager).auditEvent(factoryCaptor.capture());
        AuditEventFactory factory = factoryCaptor.getValue();
        ResourceAdminEvent event = (ResourceAdminEvent)factory.getDbEvent();
        assertThat(event.getModifier()).isEqualTo(MODIFIER_UID);
        assertThat(event.getStatus()).isEqualTo(status);
        assertThat(event.getDesc()).isEqualTo(desc);
        assertThat(event.getRequestId()).isEqualTo(REQUEST_ID);
        assertThat(event.getAction()).isEqualTo(action);
        assertThat(event.getResourceName()).isEqualTo(RESOURCE_NAME);

        if (isComponentNull) {
            assertThat(event.getServiceInstanceId()).isNull();
            assertThat(event.getCurrState()).isNull();
            assertThat(event.getCurrVersion()).isNull();
            assertThat(event.getInvariantUUID()).isNull();
            assertThat(event.getResourceType()).isEqualTo(resourceType);
        }
        else {
            assertThat(event.getServiceInstanceId()).isEqualTo(SERVICE_INSTANCE_ID);
            assertThat(event.getCurrState()).isEqualTo(CURRENT_STATE);
            assertThat(event.getCurrVersion()).isEqualTo(CURRENT_VERSION);
            assertThat(event.getInvariantUUID()).isEqualTo(INVARIANT_UUID);
        }
        if (action.equals(AuditingActionEnum.IMPORT_RESOURCE.getName())) {
            assertThat(event.getToscaNodeType()).isEqualTo(TOSCA_NODE_TYPE);
        }
        else {
            assertThat(event.getToscaNodeType()).isEmpty();
        }
        if (isPrevStateAndVersionSet) {
            assertThat(event.getPrevState()).isEqualTo(PREV_RESOURCE_STATE);
            assertThat(event.getPrevVersion()).isEqualTo(PREV_RESOURCE_VERSION);
            assertThat(event.getPrevArtifactUUID()).isEqualTo(ARTIFACT_UUID);
        }
        else {
            assertThat(event.getPrevState()).isNull();
            assertThat(event.getPrevVersion()).isNull();
            assertThat(event.getPrevArtifactUUID()).isNull();
        }
        if (isCurrFieldsProvided) {
            assertThat(event.getCurrArtifactUUID()).isEqualTo(ARTIFACT_UUID);
        }
        else {
            assertThat(event.getCurrArtifactUUID()).isNull();
        }
        if (isArtDataProvided) {
            assertThat(event.getArtifactData()).isEqualTo(ARTIFACT_DATA);
            if (resourceType.equals(ResourceTypeEnum.VFC.name())) {
                assertThat(event.getDid()).isNull();
            }
            else {
                assertThat(event.getDid()).isEqualTo(DIST_ID);
            }
        }
        else {
            assertThat(event.getArtifactData()).isNull();
            assertThat(event.getDid()).isNull();
        }
        if (isCommentProvided) {
            assertThat(event.getComment()).isEqualTo(COMMENT);
        }
        else {
            assertThat(event.getComment()).isEmpty();
        }
        if (isDistStatusProvided) {
            assertThat(event.getDcurrStatus()).isEqualTo(DCURR_STATUS);
            assertThat(event.getDprevStatus()).isEqualTo(DPREV_STATUS);
        }
        else {
            assertThat(event.getDcurrStatus()).isNull();
            assertThat(event.getDprevStatus()).isNull();
        }
    }
}