English | Português
Project made during "Unit Tests in Java: Master JUnit, Mockito and TDD" course on Udemy. It's a Java Project with Unit Testing using JUnit and other technologies detailed below. The basis project were made available by the tutor.
- Java Language.
- JUnit.
- Mockito.
- PowerMock.
- Maven.
- I kept some commented code because this is a project made during classes and these code contains diferent forms to write a code that is working.
- I thought this could be important to review the content that I've learned.
- Main package that contains DAOs, Services and more.
- Contains DAOs examples but, how this was a project made to pratice Unit Testing, they are really simple.
- LocacaoDAO: Interface of a rent class that will be mocked.
- LocacaoDAOFake: Example of the rent class DAO implementantion.
- Contains all entities of the project.
- Filme: Movie Entity.
- Locacao: Movie rental Entity.
- Usuario: User Entity.
- Contains custom Exceptions.
- FilmeSemEstoqueException: Used when the movie that the User are trying to rent is sold out.
- LocadoraException: Used to indicate that something went wrong during the rent process.
- NaoPodeDividirPorZeroException: Used when there are a division per zero during the rent calculus.
- Contains all the logic.
- Calculadora: A Calculador example, showing the main operations and using some custom exceptions.
- EmailService: A interface to simulate the Email operations.
- LocacaoService: A class with all rent operations.
- SPCService: A interface to simulate a service that consults SPC Database to check if the user have credit restrictions.
- TimerService: A service with a method for get the current date. Can be used as a workaround to mock the current date with Mockito.
- Contains the Utility classes.
- DataUtils: A Utility Date class.
- Package that contains all unit tests classes.
- Contains all Data Builders of the Entities.
- FilmeBuilder: Movie builder.
- LocacaoBuilder: Rent builder.
- UsuarioBuilder: User builder.
- Contains the runners implementations.
- ParallelRunner: Contains an example of an implementantion that can be used to run Parallel Tests.
- Contains all test classes.
- CalculadoraMockTest: Contains some examples of how Spy and Mock Annotations works.
- CalculadoraTest: Contains the tests of the Calculadora (Calculator) class.
- CalculoValorLocacaoTest: Contains the test of the rent calculus.
- LocacaoServiceTest: Contains all tests of the LocacaoService (rent) class.
- LocacaoServiceTest_PowerMock: Contains examples of methods of the LocacaoServiceTest that could use PowerMock.
- Contains all custom matchers that can be used on the tests asserts.
- Contains a Tests Suite that runs all tests from CalculoValorLocacaoTest and LocacaoServiceTest classes.