비웃음 나는 다음과 같은 서비스가 있습니다서비스 (JUnit을) 내에서 서비스
public class junit {
@autowire PlayerAccountService playerAccountService ;
@Test
public test() {
this.playerAccountService .createAccount();
assertAllSortsOfThings();
}
인가 : 내가 PlayerValidationService를 사용하는 다른 3 서비스를 사용하고 내 JUnit 테스트 클래스 이제
@Service
public class PlayerValidationService {
@Autowire
private EmailService emailService;
public boolean validatePlayerEmail(Player player) {
return this.emailService.validateEmail(player.getEmail());
}
을 어노테이션 기반 자동 와이어 링을 사용할 때 PlayerAccountService 내에서 EmailService를 조롱 할 수 있습니까? (예를 들어 우리가 함께 작업하는 일반 이메일 제공 업체를 통해 모의 검증을 확인하지 마십시오)
감사합니다.
감사를 당신의 회신, 당신이 마음을 모르면 내가 (짧은) 할 수있는 다른 방법은 무엇입니까 ... – Urbanleg
그것은 이미 2 가지 다른 방법입니다. 뭘 더 원하니? ;) btw ...'src/test/java'에 똑같은 이름의 클래스를 두는 옵션이 있습니다. 'test' 트리에있는 클래스와 리소스는'main' 대응 객체보다 우선합니다. – Steve