-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modulo 4 - Stub, Mock e Spy #2
base: main
Are you sure you want to change the base?
Commits on Nov 24, 2023
-
Configuration menu - View commit details
-
Copy full SHA for a621a88 - Browse repository at this point
Copy the full SHA a621a88View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0407c99 - Browse repository at this point
Copy the full SHA 0407c99View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0936498 - Browse repository at this point
Copy the full SHA 0936498View commit details -
Configuration menu - View commit details
-
Copy full SHA for 95b5e33 - Browse repository at this point
Copy the full SHA 95b5e33View commit details -
Configuration menu - View commit details
-
Copy full SHA for 12dfeda - Browse repository at this point
Copy the full SHA 12dfedaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8255211 - Browse repository at this point
Copy the full SHA 8255211View commit details -
Configuration menu - View commit details
-
Copy full SHA for 644247e - Browse repository at this point
Copy the full SHA 644247eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ae4ffeb - Browse repository at this point
Copy the full SHA ae4ffebView commit details -
Configuration menu - View commit details
-
Copy full SHA for f33d8cd - Browse repository at this point
Copy the full SHA f33d8cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for d7b7a88 - Browse repository at this point
Copy the full SHA d7b7a88View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b56d9a - Browse repository at this point
Copy the full SHA 2b56d9aView commit details -
2.4. Asserções de Exceptions: Comparar Mensagem passada, agora método…
… conta com duas asserções.
Configuration menu - View commit details
-
Copy full SHA for fd90773 - Browse repository at this point
Copy the full SHA fd90773View commit details -
-método quando Exception não é lançada:
Configuration menu - View commit details
-
Copy full SHA for e0de01f - Browse repository at this point
Copy the full SHA e0de01fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f47e1c - Browse repository at this point
Copy the full SHA 1f47e1cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f7bf6f - Browse repository at this point
Copy the full SHA 9f7bf6fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4fe256f - Browse repository at this point
Copy the full SHA 4fe256fView commit details -
2.6. Asserções de Timeout, é utilizado em métodos que demoram em sua …
…asserção, porque ocorre falha caso o método demore muito para ser executado, usado para não bloquear o processo de build. problema desse método é que fica bloqueado por 10 segundos.
Configuration menu - View commit details
-
Copy full SHA for 769bfff - Browse repository at this point
Copy the full SHA 769bfffView commit details -
2.6. Asserções de Timeout, é utilizado em métodos que demoram em sua …
…asserção, porque ocorre falha caso o método demore muito para ser executado, usado para não bloquear o processo de build. Esse é o melhor método para validar o tempo de executação, porque não deixa bloqueado por 10 segundos chegou no 1 segundo conforme foi configurado já lança o erro de teste
Configuration menu - View commit details
-
Copy full SHA for ef3da1a - Browse repository at this point
Copy the full SHA ef3da1aView commit details -
2.7. Asserções agrupadas com AssertAll: [Exemplo lançando erro]
-Se o primeiro método falhar para e o resto das outras asserções não serão executadas.
Configuration menu - View commit details
-
Copy full SHA for 877c5e8 - Browse repository at this point
Copy the full SHA 877c5e8View commit details -
2.7. Asserções agrupadas com AssertAll: [Exemplo correto]
-Se o primeiro método falhar para e o resto das outras asserções não serão executadas.
Configuration menu - View commit details
-
Copy full SHA for cf23cd0 - Browse repository at this point
Copy the full SHA cf23cd0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 94c9bd8 - Browse repository at this point
Copy the full SHA 94c9bd8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e0764e - Browse repository at this point
Copy the full SHA 0e0764eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 44cad1f - Browse repository at this point
Copy the full SHA 44cad1fView commit details -
2.10. Ignorando execução dos testes condicionalmente com Assumptions …
…existe duas formas: 1º) Criando variável de ambiente dentro do profile e adicionando o Assumptions. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d8c60e2 - Browse repository at this point
Copy the full SHA d8c60e2View commit details -
2.10. Ignorando execução dos testes condicionalmente com Assumptions …
…existe duas formas: 2º) Criando variável de ambiente dentro do profile e adicionando o @EnabledIfEnvironmentVariable(named = "ENV", matches = "DEV") Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b93c180 - Browse repository at this point
Copy the full SHA b93c180View commit details -
2.11. Executando testes via Maven: adicionando plugin pom.xml para ex…
…ecutar testes via terminarl - Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1c338ea - Browse repository at this point
Copy the full SHA 1c338eaView commit details -
2.11. ajustes na nomenclatura não aceita acentuação.
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 823b7be - Browse repository at this point
Copy the full SHA 823b7beView commit details -
2.11. Executando testes via Maven:
Desabilitando a execução de teste via maven. Windows `mvn clean package '-Dmaven.test.skip=true'` Linux `mvn clean package -Dmaven.test.skip=true' Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a90dc1d - Browse repository at this point
Copy the full SHA a90dc1dView commit details -
2.12. Desafio - Escrevendo testes faltantes do SaudacaoUtil, como imp…
…lementei. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a631092 - Browse repository at this point
Copy the full SHA a631092View commit details -
Configuration menu - View commit details
-
Copy full SHA for 069dc96 - Browse repository at this point
Copy the full SHA 069dc96View commit details
Commits on Nov 27, 2023
-
2.13. Refatorando classe SaudacaoUtil
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f3baded - Browse repository at this point
Copy the full SHA f3badedView commit details
Commits on Nov 28, 2023
-
2.13. Refatorando classe SaudacaoUtil
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 23565b1 - Browse repository at this point
Copy the full SHA 23565b1View commit details -
2.13. Refatorando classe SaudacaoUtil
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3a3aecd - Browse repository at this point
Copy the full SHA 3a3aecdView commit details -
2.13. Refatorando classe SaudacaoUtil
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6b12f06 - Browse repository at this point
Copy the full SHA 6b12f06View commit details -
2.13. Refatorando classe SaudacaoUtil
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b1961eb - Browse repository at this point
Copy the full SHA b1961ebView commit details -
3.1. Organizando testes com o padrão Triple A: apenas adicionando com…
…entário para facilitar o entendimento do padrão `Triple A`. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 36ed50b - Browse repository at this point
Copy the full SHA 36ed50bView commit details -
3.1. Organizando testes com o padrão Triple A
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 76e3163 - Browse repository at this point
Copy the full SHA 76e3163View commit details -
3.2. Alterando nome de exibição dos testes com @DisplayName, tanto na…
… classe como no método. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7f6b2cf - Browse repository at this point
Copy the full SHA 7f6b2cfView commit details -
3.3. Formatando nomes de testes com @DisplayNameGeneration
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 644dedf - Browse repository at this point
Copy the full SHA 644dedfView commit details -
3.4. Aplicando a nomenclatura do BDD para nomear métodos de teste
Nomenclatura BDD: Dado__..Quando__..Entao -Given = Dado -When = Quando -Then = Então Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cc8e8f8 - Browse repository at this point
Copy the full SHA cc8e8f8View commit details -
3.5. Organizando classe de testes com sub-classes e @nested
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cf83f29 - Browse repository at this point
Copy the full SHA cf83f29View commit details -
3.6. Preparando o cenário de testes com @beforeeach e @BeforeAll, usa…
…ndo com cenário de teste que precisam de depenências de classes. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e50f51b - Browse repository at this point
Copy the full SHA e50f51bView commit details -
3.6. Preparando o cenário de testes com @beforeeach e @BeforeAll, usa…
…ndo com cenário de teste que precisam de depenências de classes. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 57352c5 - Browse repository at this point
Copy the full SHA 57352c5View commit details
Commits on Nov 29, 2023
-
3.7. Um teste deve ter uma única asserção?
Sim deve ser refatorado para ter apenas uma asserção, é uma boa prática. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d92ee1a - Browse repository at this point
Copy the full SHA d92ee1aView commit details -
3.8. Combinando @nested e @beforeeach com a nomenclatura do BDD
Exemplo Top! Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 429e92b - Browse repository at this point
Copy the full SHA 429e92bView commit details -
3.8. Combinando @nested e @beforeeach com a nomenclatura do BDD
Exemplo Top! Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8708f06 - Browse repository at this point
Copy the full SHA 8708f06View commit details -
3.9. Desafio - Implemente a lógica e testes de um carrinho de compras:
[Cenário]-Dado um carrinho de compra com 2 tipos de itens e quantidade 3 Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6d84bb0 - Browse repository at this point
Copy the full SHA 6d84bb0View commit details -
3.9. Desafio - Implemente a lógica e testes de um carrinho de compras:
[Cenário]-Dado um carrinho de compra com 0 itens Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fb9f890 - Browse repository at this point
Copy the full SHA fb9f890View commit details -
3.9. Desafio - Implemente a lógica e testes de um carrinho de compras:
[Cenário]-Dado um carrinho de compra com 2 tipos de itens e quantidade 3 -> Remover produto carrinho Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 14eb8a2 - Browse repository at this point
Copy the full SHA 14eb8a2View commit details
Commits on Dec 1, 2023
-
3.9. Desafio - Arquivo com resolução.
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a6c0516 - Browse repository at this point
Copy the full SHA a6c0516View commit details -
Merge pull request #1 from leco123/MODULO-3
Modulo 3 - Organizando testes unitários
Configuration menu - View commit details
-
Copy full SHA for f13ecd1 - Browse repository at this point
Copy the full SHA f13ecd1View commit details
Commits on Dec 8, 2023
-
3.9. Desafio - Arquivo com resolução.
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 15f1130 - Browse repository at this point
Copy the full SHA 15f1130View commit details -
3.9. Desafio - Arquivo com resolução.
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 461dec2 - Browse repository at this point
Copy the full SHA 461dec2View commit details
Commits on Dec 9, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 1b4d2dd - Browse repository at this point
Copy the full SHA 1b4d2ddView commit details -
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c236cbc - Browse repository at this point
Copy the full SHA c236cbcView commit details -
4.1. Implementações falsas com Stub
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e38b73c - Browse repository at this point
Copy the full SHA e38b73cView commit details
Commits on Dec 14, 2023
-
4.2. Introdução ao Mock + 4.3. Simulando classes com Mockito
-Adicionado Dependência do Mockito. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 673fd04 - Browse repository at this point
Copy the full SHA 673fd04View commit details -
4.2. Introdução ao Mock + 4.3. Simulando classes com Mockito
-Adicionado Dependência do Mockito. Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8c4d6bd - Browse repository at this point
Copy the full SHA 8c4d6bdView commit details -
4.2. Introdução ao Mock + 4.3. Simulando classes com Mockito
-Renomeando arquivos Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9b532fb - Browse repository at this point
Copy the full SHA 9b532fbView commit details -
4.2. Introdução ao Mock + 4.3. Simulando classes com Mockito
-Criando Mock: -> 1º) Deve ser instanciado e criado um mock para classe; -> 2º) Precisa definir comportamento do mock; Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 68cfab3 - Browse repository at this point
Copy the full SHA 68cfab3View commit details -
Extensão do Mockito para o próprio JUnit -`@ExtendWith(MockitoExtension.class)` -`@Mock` Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9410636 - Browse repository at this point
Copy the full SHA 9410636View commit details -
4.5. Alterando estado dos parâmetros passados no mock
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 63f39ac - Browse repository at this point
Copy the full SHA 63f39acView commit details
Commits on Dec 20, 2023
-
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5c1b46a - Browse repository at this point
Copy the full SHA 5c1b46aView commit details -
4.7. Verificando chamada de métodos com mock usando Mockito verify
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 134fef3 - Browse repository at this point
Copy the full SHA 134fef3View commit details -
4.7. Verificando chamada de métodos com mock usando Mockito verify
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f50d504 - Browse repository at this point
Copy the full SHA f50d504View commit details -
4.8. Forçando uma Exception com mock
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 900a59a - Browse repository at this point
Copy the full SHA 900a59aView commit details
Commits on Dec 21, 2023
-
4.8. Forçando uma Exception com mock
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 20368c5 - Browse repository at this point
Copy the full SHA 20368c5View commit details
Commits on Jan 17, 2024
-
4.8. Forçando uma Exception com mock
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 45df9bb - Browse repository at this point
Copy the full SHA 45df9bbView commit details -
4.9. Capturando parâmetros enviados aos mocks com Argument Captor
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 48d9571 - Browse repository at this point
Copy the full SHA 48d9571View commit details -
4.10. Espionando um objeto real com Mockito
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for af7d21c - Browse repository at this point
Copy the full SHA af7d21cView commit details -
4.11. Alterando retorno de um mock após chamadas consecutivas
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 39688a4 - Browse repository at this point
Copy the full SHA 39688a4View commit details -
4.11. Alterando retorno de um mock após chamadas consecutivas
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8d82194 - Browse repository at this point
Copy the full SHA 8d82194View commit details -
4.12. Verificando ordem de chamada de métodos
-Dos nossos mocks; Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b2c922c - Browse repository at this point
Copy the full SHA b2c922cView commit details
Commits on Jan 19, 2024
-
4.13. Usando mock em métodos estáticos
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d8ee13c - Browse repository at this point
Copy the full SHA d8ee13cView commit details
Commits on Jan 21, 2024
-
4.14. Entendendo problema de mocks não utilizados
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 616f4c8 - Browse repository at this point
Copy the full SHA 616f4c8View commit details -
4.15. Implementando testes no CadastroEditor no método de edição
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 76ee00c - Browse repository at this point
Copy the full SHA 76ee00cView commit details -
4.16. Desafio - Criar testes do CadastroPost
Signed-off-by: Alex de Carvalho <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f814f81 - Browse repository at this point
Copy the full SHA f814f81View commit details