package br.com.alura.maven;
public class Produto {
private final String nome;
private final double preco;
public Produto(String nome, double preco) {
super();
this.nome = nome;
this.preco = preco;
}
public String getNome() {
return nome;
}
public double getPreco() {
return preco;
}
public double getPrecoComImposto() {
return preco*1.1;
}
}
package br.com.alura.maven;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class ProdutoTeste {
@Test
public void verificaPrecoComImposto () {
Produto bala = new Produto("juquinha", 0.1);
assertEquals(0.11, bala.getPrecoComImposto(), 0.0000001);
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.alura.maven</groupId>
<artifactId>produtos</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>produtos</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.11.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.12.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
O relatório sempre sai igual com 0%