Пример #1
0
 @Test(expected = MojoExecutionException.class)
 public void testTimeout() throws MojoExecutionException {
   Play2CleanMojo mojo = new Play2CleanMojo();
   mojo.timeout = 1; // 1 ms is just not enough
   mojo.project = mock(MavenProject.class);
   mojo.execute();
 }
Пример #2
0
 @Test
 public void testPlay2LocationUsingSystemVariable() throws MojoExecutionException {
   System.setProperty(AbstractPlay2Mojo.ENV_PLAY2_HOME, "somewhere");
   Play2CleanMojo mojo = new Play2CleanMojo();
   mojo.play2Home = "ignored";
   assertThat(mojo.getPlay2Home()).isEqualTo("somewhere");
 }
Пример #3
0
  @Test
  public void testPlay2LocationUsingSetting() throws MojoExecutionException {
    System.clearProperty(AbstractPlay2Mojo.ENV_PLAY2_HOME);

    // I don't really like this conditional test, but I can't be usre of the existence of the env
    // variable.
    Play2CleanMojo mojo = new Play2CleanMojo();
    mojo.play2Home = "somewhere";

    assertThat(mojo.getPlay2Home()).isEqualTo("somewhere");
  }
Пример #4
0
  @Test
  public void testPlay2LocationUsingEnvVariable() throws MojoExecutionException {
    String env = System.getenv(AbstractPlay2Mojo.ENV_PLAY2_HOME);
    System.clearProperty(AbstractPlay2Mojo.ENV_PLAY2_HOME);

    // I don't really like this conditional test, but I can't be sure of the existence of the env
    // variable.
    Play2CleanMojo mojo = new Play2CleanMojo();
    if (env == null) {
      mojo.play2Home = "somewhere";
      env = "somewhere";
    }

    assertThat(mojo.getPlay2Home()).isEqualTo(env);
  }