use of uk.gov.gchq.gaffer.operation.data.CustomVertex in project Gaffer by gchq.
the class OperationImplTest method shouldValidateASingleMissingRequiredField.
@Test
public void shouldValidateASingleMissingRequiredField() throws SerialisationException {
// Given
final String requiredField1 = "value1";
final Date optionalField1 = new Date(1L);
final CustomVertex optionalField2 = new CustomVertex("type2", "value2");
final OperationImpl op = new OperationImpl.Builder().requiredField1(requiredField1).optionalField1(optionalField1).optionalField2(optionalField2).build();
// When
final ValidationResult validationResult = op.validate();
// Then
assertEquals(Sets.newHashSet("requiredField2 is required for: " + op.getClass().getSimpleName()), validationResult.getErrors());
}
use of uk.gov.gchq.gaffer.operation.data.CustomVertex in project Gaffer by gchq.
the class OperationImplTest method builderShouldCreatePopulatedOperation.
@Test
@Override
public void builderShouldCreatePopulatedOperation() {
// Given / When
final String requiredField1 = "value1";
final CustomVertex requiredField2 = new CustomVertex("type1", "value1");
final Date optionalField1 = new Date(1L);
final CustomVertex optionalField2 = new CustomVertex("type2", "value2");
final OperationImpl op = new OperationImpl.Builder().requiredField1(requiredField1).requiredField2(requiredField2).optionalField1(optionalField1).optionalField2(optionalField2).build();
// Then
assertEquals(requiredField1, op.getRequiredField1());
assertEquals(requiredField2, op.getRequiredField2());
assertEquals(optionalField1, op.getOptionalField1());
assertEquals(optionalField2, op.getOptionalField2());
}
use of uk.gov.gchq.gaffer.operation.data.CustomVertex in project Gaffer by gchq.
the class InputImplTest method shouldShallowCloneOperation.
@Test
public void shouldShallowCloneOperation() {
// Given
final String requiredField1 = "value1";
final CustomVertex requiredField2 = new CustomVertex("type1", "value1");
final Date optionalField1 = new Date(1L);
final CustomVertex optionalField2 = new CustomVertex("type2", "value2");
final List<String> input = Arrays.asList("1", "2", "3", "4");
final InputImpl op = new InputImpl.Builder().requiredField1(requiredField1).requiredField2(requiredField2).optionalField1(optionalField1).optionalField2(optionalField2).input(input).build();
// When
final InputImpl clone = (InputImpl) op.shallowClone();
// Then
assertEquals(requiredField1, clone.getRequiredField1());
assertEquals(requiredField2, clone.getRequiredField2());
assertEquals(optionalField1, clone.getOptionalField1());
assertEquals(optionalField2, clone.getOptionalField2());
assertSame(input, clone.getInput());
}
Aggregations