コード例 #1
0
  @Test
  public void testValidateNoFaultValid() {
    DefautMonitorContext context = new DefautMonitorContext();

    MessageNode mesgNode = new MessageNode();
    mesgNode.setOperator("buy");

    Message mesg = new Message();
    mesg.setOperator("buy");

    Result result = context.validate(null, mesgNode, mesg);

    if (result != Result.VALID) {
      fail("Should be valid");
    }
  }
コード例 #2
0
  @Test
  public void testValidateMessageFaultEmptyValid() {
    DefautMonitorContext context = new DefautMonitorContext();

    MessageNode mesgNode = new MessageNode();
    mesgNode.setOperator(InteractionUtil.getOperator("buy", ""));

    Message mesg = new Message();
    mesg.setOperator("buy");
    mesg.setFault("");

    Result result = context.validate(null, mesgNode, mesg);

    if (!result.isValid()) {
      fail("Should be valid");
    }
  }
コード例 #3
0
  @Test
  public void testValidateMessageFaultInvalid() {
    DefautMonitorContext context = new DefautMonitorContext();

    MessageNode mesgNode = new MessageNode();
    mesgNode.setOperator("buy");

    Message mesg = new Message();
    mesg.setOperator("buy");
    mesg.setFault("BuyFailed");

    Result result = context.validate(null, mesgNode, mesg);

    if (result.isValid()) {
      fail("Should be invalid");
    }
  }
コード例 #4
0
  @Test
  public void testValidateNodeFaultInvalid() {
    DefautMonitorContext context = new DefautMonitorContext();

    MessageNode mesgNode = new MessageNode();
    mesgNode.setOperator(InteractionUtil.getOperator("buy", "BuyFailed"));

    Annotation ann = new Annotation();
    mesgNode.getAnnotation().add(ann);
    ann.setId("Id");
    ann.setValue(" Fault(name=BuyFailed) ");

    Message mesg = new Message();
    mesg.setOperator("buy");

    Result result = context.validate(null, mesgNode, mesg);

    if (result.isValid()) {
      fail("Should be invalid");
    }
  }