Пример #1
0
 protected boolean containsConsistentMessage(List<Message> list, MessageTypeInt type) {
   for (Message m : list) {
     System.out.println("**" + m.getMessageType() + "|" + m.getMessageLevel());
     if (m.getMessageType().equals(type)) {
       return true;
     }
   }
   return false;
 }
  private void runTest(String goldenIhtml, String inputIhtml, Message... expectedMessages)
      throws Exception {
    Element ihtmlRoot =
        new DomParser(
                DomParser.makeTokenQueue(
                    FilePosition.startOfFile(is), new StringReader(inputIhtml), true, false),
                true,
                mq)
            .parseDocument();
    new IhtmlSanityChecker(mq).check(ihtmlRoot);

    for (Message msg : expectedMessages) {
      assertMessage(
          true,
          msg.getMessageType(),
          msg.getMessageLevel(),
          msg.getMessageParts().toArray(new MessagePart[0]));
    }
    assertMessagesLessSevereThan(MessageLevel.WARNING);

    String checkedIhtml = Nodes.render(ihtmlRoot, MarkupRenderMode.XML);
    assertEquals(goldenIhtml, checkedIhtml);
  }