토비의 스프링 4장 에러
2022. 5. 10. 15:45ㆍSpring/에러
assertThat(set.translate(null, null, sqlEx), is(DuplicateKeyException.class)); 가 에러가 났다.
잘못된 값이 들어왔다는 뜻인데
The method assertThat(T, Matcher<? super T>) in the type MatcherAssert is not applicable for the arguments (DataAccessException, Matcher<DuplicateKeyException>) 라고 에러가 난다.
대충 구글에서 번역해서 보자면 DuplicateKeyException.class가 인수로써 맞지 않는덴다
구글에서 찾아보니 다른분도 똑같이 에러가 났었고, is에서 요구하는 인수가 아니기때문에
assertThat(set.translate(null, null, sqlEx), instanceOf(DuplicateKeyException.class));로 고치면 됐다.
junit5를 쓰고있어서 지양하는 코드도 많은데 그래도 잘 되서 다행이다.
'Spring > 에러' 카테고리의 다른 글
Spring 스프링 java.lang.classnotfoundexception: com.sun.xml.internal.bind.v2.contextfactory 에러 해결 방법 (0) | 2022.06.09 |
---|---|
Junit5 테스트시 객체주입 안되는 에러 (0) | 2022.05.11 |
spring 오류 [java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy] (0) | 2022.04.26 |
[Spring] pom.xml war의존성 에러 (0) | 2021.08.21 |
스프링 공부하다 jsp뷰 에러 (0) | 2021.08.18 |