From c46091e742f00451b49ee93d9367697aea25ed5b Mon Sep 17 00:00:00 2001 From: giovanni1106 Date: Thu, 7 Apr 2022 23:13:59 -0300 Subject: [PATCH] =?UTF-8?q?Cria=C3=A7=C3=A3o=20de=20testes=20unit=C3=A1rio?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AluguelCarros/.classpath | 1 + AluguelCarros/src/Pessoas/AdminTest.java | 17 +++++++++++++++++ AluguelCarros/src/Pessoas/UsuarioTest.java | 15 +++++++++++++++ AluguelCarros/src/Sistema/LoginTest.java | 21 +++++++++++++++++++++ AluguelCarros/src/veiculo/AgenciaTest.java | 20 ++++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 AluguelCarros/src/Pessoas/AdminTest.java create mode 100644 AluguelCarros/src/Pessoas/UsuarioTest.java create mode 100644 AluguelCarros/src/Sistema/LoginTest.java create mode 100644 AluguelCarros/src/veiculo/AgenciaTest.java diff --git a/AluguelCarros/.classpath b/AluguelCarros/.classpath index 9aa6d15..dd33a9e 100644 --- a/AluguelCarros/.classpath +++ b/AluguelCarros/.classpath @@ -6,5 +6,6 @@ + diff --git a/AluguelCarros/src/Pessoas/AdminTest.java b/AluguelCarros/src/Pessoas/AdminTest.java new file mode 100644 index 0000000..7373494 --- /dev/null +++ b/AluguelCarros/src/Pessoas/AdminTest.java @@ -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")); + } +} diff --git a/AluguelCarros/src/Pessoas/UsuarioTest.java b/AluguelCarros/src/Pessoas/UsuarioTest.java new file mode 100644 index 0000000..df47ad8 --- /dev/null +++ b/AluguelCarros/src/Pessoas/UsuarioTest.java @@ -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")); + } + +} diff --git a/AluguelCarros/src/Sistema/LoginTest.java b/AluguelCarros/src/Sistema/LoginTest.java new file mode 100644 index 0000000..fc9b976 --- /dev/null +++ b/AluguelCarros/src/Sistema/LoginTest.java @@ -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")); + } + +} diff --git a/AluguelCarros/src/veiculo/AgenciaTest.java b/AluguelCarros/src/veiculo/AgenciaTest.java new file mode 100644 index 0000000..aa36286 --- /dev/null +++ b/AluguelCarros/src/veiculo/AgenciaTest.java @@ -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")); + } +}