본문 바로가기
728x90
반응형

Test3

[SpringBoot] Test환경에 H2 적용하기 다음과 같이 db구성이 되어있을때 Test환경에 H2 적용하는 방법입니다. https://moonsiri.tistory.com/53 [Spring] java config로 hikari datasource, transaction aop 설정 pom.xml org.springframework.boot spring-boot-starter-jdbc org.mybatis.spring.boot mybatis-spring-boot-starter 2.1.3 org.apache.commons commons-dbcp2 mysql mysql-connector-java runtime application.ym.. moonsiri.tistory.com 우선 pom.xml에 dependency를 추가합니다. com.h2datab.. 2021. 8. 4.
[Spring] Mockmvc에 ExceptionHandler 등록 Controller Test 를 위해 MockMvc 기반으로 Test를 할 때, @ControllerAdvice 로 지정한 Global Exception Handler가 Test에서 동작하지 않을 때가 있습니다. ​ Mockmvc를 생성할때 아래와 같이 setControllerAdvice()로 사용할 class를 지정해주어야 합니다. ​ Normally @ControllerAdvice are auto-detected as long as they're declared as Spring beans. However since the standalone setup does not load any Spring config, they need to be registered explicitly here instead.. 2020. 10. 31.
[Spring Batch4] 배치 Test를 위한 Configuration - Spring Batch Test 공식 문서 (한국어 번역)​공식 문서에 나와있는 batch job의 end to end 테스트 예제는 다음과 같습니다.@SpringBatchTest@RunWith(SpringRunner.class) // 스프링 JUnit 기능을 사용하겠다는 표시@ContextConfiguration(classes = SimpleJobConfiguration.class) // ApplicationContext에 설정할 리소스 명시public class SimpleJobTest { @Autowired private JobLauncherTestUtils jobLauncherTestUtils; @Test public void simple_job_테스트() throw.. 2020. 10. 31.
728x90
반응형