Commit 0b4cb022 authored by diego7lts7's avatar diego7lts7 :eagle:
Browse files

Adicionando o conteudo sobre os testes unitarios com operadores aritmeticos

parent 672e42fb
No related merge requests found
Showing with 83 additions and 0 deletions
+83 -0
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Aula04.iml" filepath="$PROJECT_DIR$/Aula04.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="TEST">
<library name="JUnit4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
import org.junit.Assert;
import org.junit.Test;
public class ExemploAula04 {
@Test
public void deveSomarCorretamenteDoisNumerosInteiros(){
// Triple A => Arrange, Act, Assert
int valorA = 8;
int valorB = 2;
int resEsperado = 10;
int soma = valorA + valorB;
Assert.assertEquals(resEsperado, soma);
}
@Test
public void delta(){
double valorA = 1.5;
double valorB = 1.6;
double resEsperado = 3.1;
double soma = valorA + valorB;
Assert.assertEquals(resEsperado, soma, 0);
}
@Test
public void deltaTestValorPI(){
final double PI = 3.14159;
double valorEsperado = 3.14;
double soma = PI + valorEsperado;
Assert.assertEquals(valorEsperado, PI, 0.01);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment