Пример #1
0
  /**
   * Proper execution of the maven project, but the coverage file was not found, can be test by
   * giving a random non existing output directory
   */
  @Test
  public void testCoverageXMLNotFound() {
    System.setSecurityManager(new NoExitSecurityManager());
    boolean exceptionThrown = false;

    cobertura = new Cobertura("src/test/resources/simpleMavenProject");
    cobertura.setOutputDirectory("target/randomFolder");
    try {
      cobertura.executeCobertura();
    } catch (ExitException e) {
      exceptionThrown = true;
      assertEquals("Exit status invalid", OperiasStatus.COVERAGE_XML_NOT_FOUND.ordinal(), e.status);
    }
    System.setSecurityManager(null);
    assertTrue("No exception was thrown", exceptionThrown);
  }
Пример #2
0
 /** Simple test which executes a mvn project, retrieves the report and cleans up afterwards */
 @Test
 public void testCoberturaExecution() {
   cobertura = new Cobertura("src/test/resources/simpleMavenProject");
   cobertura.setOutputDirectory("target/simpleMavenProject");
   assertNotNull("Executing cobertura failed", cobertura.executeCobertura());
 }