コード例 #1
0
  @Test
  public void testGetContent_shouldTruncateWhenLineLimitIsHit() throws Exception {
    buildLogContent.maxLines = 2;
    buildLogContent.evaluate(build, listener, BuildLogContent.MACRO_NAME);

    verify(build).getLog(2);
  }
コード例 #2
0
  @Test
  public void testGetContent_shouldEscapeHtmlWhenArgumentEscapeHtmlSetToTrue() throws Exception {
    when(build.getLog(anyInt()))
        .thenReturn(
            new LinkedList<String>() {
              {
                add("<b>bold</b>");
              }
            });

    buildLogContent.escapeHtml = true;
    String content = buildLogContent.evaluate(build, listener, BuildLogContent.MACRO_NAME);

    assertEquals("&lt;b&gt;bold&lt;/b&gt;\n", content);
  }
コード例 #3
0
  @Test
  public void testGetContent_shouldDefaultToNotEscapeHtml() throws Exception {
    when(build.getLog(anyInt()))
        .thenReturn(
            new LinkedList<String>() {
              {
                add("<b>bold</b>");
              }
            });

    String content = buildLogContent.evaluate(build, listener, BuildLogContent.MACRO_NAME);

    assertEquals("<b>bold</b>\n", content);
  }
コード例 #4
0
  @Test
  public void testGetContent_shouldConcatLogWithoutLineLimit() throws Exception {
    when(build.getLog(anyInt()))
        .thenReturn(
            new LinkedList<String>() {
              {
                add("line 1");
                add("line 2");
                add("line 3");
              }
            });

    String content = buildLogContent.evaluate(build, listener, BuildLogContent.MACRO_NAME);

    assertEquals("line 1\nline 2\nline 3\n", content);
  }
コード例 #5
0
  @Test
  public void testGetContent_shouldDefaultToMaxLines() throws Exception {
    buildLogContent.evaluate(build, listener, BuildLogContent.MACRO_NAME);

    verify(build).getLog(BuildLogContent.MAX_LINES_DEFAULT_VALUE);
  }