import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@Test
public void testGetPropertyNames() {
- assertThat(operation.getPropertyNames()).isEqualTo(List.of(OperationProperties.AAI_VSERVER_LINK));
+ assertThat(operation.getPropertyNames()).isEqualTo(List.of(OperationProperties.EVENT_PAYLOAD));
}
@Test
checkOutcome();
}
+ @Test
+ public void testGetEventPayload() {
+ // in neither property nor event
+ assertNull(operation.getEventPayload());
+
+ // only in event
+ event.setPayload("valueA2");
+ assertEquals("valueA2", operation.getEventPayload());
+
+ // both - should choose the property
+ operation.setProperty(OperationProperties.EVENT_PAYLOAD, "valueB");
+ assertEquals("valueB", operation.getEventPayload());
+
+ // both - should choose the property, even if it's null
+ operation.setProperty(OperationProperties.EVENT_PAYLOAD, null);
+ assertNull(operation.getEventPayload());
+ }
+
protected void checkOutcome() {
assertSame(outcome, operation.setOutcome(outcome, PolicyResult.SUCCESS, response));
assertEquals(PolicyResult.SUCCESS, outcome.getResult());