コード例 #1
0
ファイル: HtmlDivTest.java プロジェクト: sivamskr/HtmlFlow
 /** Test method for {@link htmlflow.elements.HtmlDiv#getElementName()}. */
 @Test
 public void testGetElementName() throws Exception {
   HtmlView<Task> taskView = new HtmlView<Task>();
   assertEquals(
       ElementType.DIV + " element was expected",
       ElementType.DIV.toString(),
       taskView.body().div().getElementName());
 }
コード例 #2
0
ファイル: HtmlDivTest.java プロジェクト: sivamskr/HtmlFlow
  @Test
  public void testIdAndClassAttribute() throws Exception {
    HtmlView<Task> taskView = new HtmlView<Task>();
    assertEquals(
        ElementType.DIV + " elementwas expected",
        ElementType.DIV.toString(),
        taskView.body().div().getElementName());

    String divClass = "divClass";
    String divId = "divId";
    taskView.body().div().classAttr(divClass).idAttr(divId);
    Task t1 = new Task("Unit Test", "Test of element name", Priority.High, Status.Progress);
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(byteArrayOutputStream);
    taskView.setPrintStream(out).write(0, t1);
    String result = byteArrayOutputStream.toString();
    System.out.println(result);
    assertTrue(result.contains("<div"));
    assertTrue(result.contains("</div>"));
    assertTrue(result.contains(divClass));
    assertTrue(result.contains(divId));
  }