コード例 #1
0
  @Test
  public void testWhenTemplateNotFoundThrowFileNotFoundException() throws Exception {
    content.template = "template-does-not-exist";
    String output = content.evaluate(build, listener, JellyScriptContent.MACRO_NAME);

    assertEquals(
        "Jelly file [template-does-not-exist] was not found in $JENKINS_HOME/email-templates.",
        output);
  }
コード例 #2
0
  /**
   * Makes sure that the rendering of changeset doesn't use a Subversion (or any other SCM) specific
   * methods.
   */
  @Test
  public void testChangeLogDisplayShouldntOnlyRelyOnPortableMethods() throws Exception {
    content.template = "text";

    when(build.getTimestamp()).thenReturn(new GregorianCalendar());
    mockChangeSet(build);

    String output = content.evaluate(build, listener, JellyScriptContent.MACRO_NAME);

    assertTrue(
        output.contains(
            "CHANGE SET\n"
                + "Revision  by Kohsuke Kawaguchi: (COMMIT MESSAGE)\n"
                + "  change: edit path1\n"
                + "  change: add path2\n"));
  }
コード例 #3
0
  /**
   * Makes sure that the rendering of changeset doesn't use a Subversion (or any other SCM) specific
   * methods.
   */
  @Test
  public void testChangeLogDisplayShouldntOnlyRelyOnPortableMethods2() throws Exception {
    content.template = "html";

    when(build.getTimestamp()).thenReturn(new GregorianCalendar());
    mockChangeSet(build);

    String output = content.evaluate(build, listener, JellyScriptContent.MACRO_NAME);

    assertTrue(output.contains("COMMIT MESSAGE"));
    assertTrue(output.contains("Kohsuke Kawaguchi"));
    assertTrue(output.contains("path1"));
    assertTrue(output.contains("path2"));
    assertTrue(output.contains("edit"));
    assertTrue(output.contains("add"));
  }
コード例 #4
0
 @Test
 public void testShouldFindTemplateOnClassPath() throws Exception {
   content.template = "empty-template-on-classpath";
   assertEquals("HELLO WORLD!", content.evaluate(build, listener, JellyScriptContent.MACRO_NAME));
 }