@Test(expected = RuntimeException.class) public void testValidateOperand_keyempty() { Expression expression = new Expression(); expression.setOperator(Operator.AND); List<Operand> operandsList = new ArrayList<>(); Operand testOperand = new Operand(); testOperand.setField(new Field("", "sample-app")); operandsList.add(testOperand); expression.setOperands(operandsList); RequestValidator.validateExpression(expression); }
public static void validateExpression(Expression expression) { Assert.notNull(expression, "subscription expression can't null"); Assert.isTrue(Operator.AND.equals(expression.getOperator()), "Only AND operator is supported now"); Assert.notEmpty(expression.getOperands(), "Operands can't be empty"); expression.getOperands().forEach(operand -> validateOperand(operand)); }
RequestValidator { public static void validateExpression(Expression expression) { Assert.notNull(expression, "subscription expression can't null"); Assert.isTrue(Operator.AND.equals(expression.getOperator()), "Only AND operator is supported now"); Assert.notEmpty(expression.getOperands(), "Operands can't be empty"); expression.getOperands().forEach(operand -> validateOperand(operand)); } }
RequestValidator { public static void validateExpression(Expression expression) { Assert.notNull(expression, "subscription expression can't null"); Assert.isTrue(Operator.AND.equals(expression.getOperator()), "Only AND operator is supported now"); Assert.notEmpty(expression.getOperands(), "Operands can't be empty"); expression.getOperands().forEach(operand -> validateOperand(operand)); }  }
RequestValidator { public static void validateExpression(Expression expression) { Assert.notNull(expression, "subscription expression can't null"); Assert.isTrue(Operator.AND.equals(expression.getOperator()), "Only AND operator is supported now"); Assert.notEmpty(expression.getOperands(), "Operands can't be empty"); expression.getOperands().forEach(operand -> validateOperand(operand)); }  static void validateUser(User user); static void validateExpression(Expression expression); static void validateBoolean(Boolean condition); static void validateMappingDetector(ConsumerDetectorMapping consumerDetectorMapping); static void validateDetectorDocument(DetectorDocument document); static void validateDetector(Detector detector); }
RequestValidator { public static void validateExpression(Expression expression) { Assert.notNull(expression, "subscription expression can't null"); Assert.isTrue(Operator.AND.equals(expression.getOperator()), "Only AND operator is supported now"); Assert.notEmpty(expression.getOperands(), "Operands can't be empty"); expression.getOperands().forEach(operand -> validateOperand(operand)); }  static void validateUser(User user); static void validateExpression(Expression expression); static void validateBoolean(Boolean condition); static void validateMappingDetector(ConsumerDetectorMapping consumerDetectorMapping); static void validateDetectorDocument(DetectorDocument document); static void validateDetector(Detector detector);  }