This is for my friend's studying SpringBoot. I'm teaching SpringBoot with making sample code.
This Repository has some sample codes like below.
@RestControllerand the test codes with using MvcMock.- Getting parameter from url with
@PathVariable. - Getting parameter from request parameter with
@RequestParam - Mocking a class with
Mockito.- Defining mock's operation.
- Verifying calls count of component method as repository with using
@Mockand@InjectMocks.
- Testing repository class with
mybatis- insert
- select
- Testing repository class with
DBUnit@DatabaseSetupfor preparing table data.- Control for rollback test data with
@Transactionalafter test executed.
- Clone this repository.
- Change directory to cloned one.
- Run
mvn install. Runbrew install mavenor install maven if your env doesn't have maven. - Run
mvn spring-boot:run
- only Mybatis, I can't use
@Columnbecause this annotation is prepared by JPA. - Not using JPA, DTO class member needs to be written snake case in case with column name is written by that case.