스프링과 JPA 기반 웹 어플리케이션 개발/6부 패키지와 테스트 정리2 70. 테스트 클래스 정리 ObjectMother를 적용하자 https://martinfowler.com/bliki/ObjectMother.html 테스트에 필요한 데이터를 만드는데 도움을 주는 유틸리티 AccountFactory와 StudyFactoryt를 만들고 테스트 픽처 메소드 옮기기 상속 보다는 위임을 커스텀 애노테이션으로 테스트 애노테이션 묶음 만들기 @Retention(RetentionPilicy.RUNTIME) @Target(ElementType.TYPE) @Transactional @SpringBootTest @AutoConfigureMockMvc public @interface MockMvcTest { } Account 생성을 도와주는 AccountFactory 클래스 생성 package me.weekbelt.s.. 2020. 5. 6. 69. 패키지 구조 정리 ArchUnit 아키텍처 테스트 유틸리티 (JUnit 5 지원) https://www.archunit.org/ Unit test your Java architecture Start enforcing your architecture within 30 minutes using the test setup you already have. www.archunit.org com.tngtech.archunit archunit-junit5 0.13.1 test 패키지 정리 인프라 패키지에서 모듈 패키지 사용하지 않기. Study 패키지에 있는 클래스는 Event와 Study에 들어있는 클래스에서만 사용한다. Event 패키지에 있는 클래스는 Study와 Account 그리고 Event 패키지에 들어있는 클래스를 사용한.. 2020. 5. 6. 이전 1 다음