### Question:
ExpressionRepresentationRequiredValidator implements ConstraintValidator<ExpressionRepresentationRequired, ClientExpressionContainer>, ValidationErrorDescriptorBuilder { @Override public boolean isValid(ClientExpressionContainer value, ConstraintValidatorContext context) { return value == null || value.getObject() != null || value.getString() != null; }  @Override ErrorDescriptor build(ConstraintViolation violation); @Override void initialize(ExpressionRepresentationRequired constraintAnnotation); @Override boolean isValid(ClientExpressionContainer value, ConstraintValidatorContext context);  }### Answer:
@Test public void isValid_nullContainer_true() { final ConstraintValidatorContext stub = mock(ConstraintValidatorContext.class); boolean isValid = objectUnderTests.isValid( null, stub ); assertTrue(isValid); }
@Test public void isValid_containerWithNullStringAndNullObject_false() { final ConstraintValidatorContext stub = mock(ConstraintValidatorContext.class); ClientExpressionContainer container = new ClientExpressionContainer() .setObject(null) .setString(null); boolean isValid = objectUnderTests.isValid(container, stub); assertFalse(isValid); verifyZeroInteractions(stub); }
@Test public void isValid_containerWithNonNullString_true() { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); ClientExpressionContainer container = new ClientExpressionContainer() .setString(TEST_STRING) .setObject(null); boolean isValid = objectUnderTests.isValid(container, context); assertTrue(isValid); verifyZeroInteractions(context); }
@Test public void isValid_containerWithNonNullObject_true() { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); ClientExpressionContainer container = new ClientExpressionContainer() .setObject(new ClientAdd()) .setString(null); boolean isValid = objectUnderTests.isValid(container, context); assertTrue(isValid); verifyZeroInteractions(context); }