Skip to content

Commit

Permalink
Criação de testes unitários
Browse files Browse the repository at this point in the history
  • Loading branch information
giovanniacg committed Apr 8, 2022
1 parent def3478 commit c46091e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions AluguelCarros/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions AluguelCarros/src/Pessoas/AdminTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package Pessoas;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

import Sistema.BancoDados;

class AdminTest {

@Test
void testTesteLogin() {
BancoDados.cadastrarAdm[0] = new Admin("Login1", "123");

assertEquals(false, Admin.TesteLogin("Login1"));
}
}
15 changes: 15 additions & 0 deletions AluguelCarros/src/Pessoas/UsuarioTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package Pessoas;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

class UsuarioTest {

@Test
void testIsCPF() {
assertEquals(false, Usuario.isCPF("123456789"));
assertEquals(true, Usuario.isCPF("95337616013"));
}

}
21 changes: 21 additions & 0 deletions AluguelCarros/src/Sistema/LoginTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package Sistema;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

import Pessoas.Admin;
import Pessoas.Usuario;

class LoginTest {

@Test
void testLogando() {
BancoDados.cadastrarAdm[0] = new Admin("Login", "Senha");

assertEquals(false, Login.Logando("Login", "a"));
assertEquals(false, Login.Logando("a", "Senha"));
assertEquals(true, Login.Logando("Login", "Senha"));
}

}
20 changes: 20 additions & 0 deletions AluguelCarros/src/veiculo/AgenciaTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package veiculo;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;

import Sistema.BancoDados;
import Sistema.Login;

class AgenciaTest {

@Test
void testTesteId() {
BancoDados.cadastrarAgencia[0] = new Agencia("AG001", "Rua 3", "35", "Bairro principal", "São Paulo", "Estado do bem",
"Melhor Pais");

assertEquals(false, Agencia.TesteId("AG001"));
assertEquals(true, Agencia.TesteId("AG002"));
}
}

0 comments on commit c46091e

Please sign in to comment.