Server Enterprise/Gradle & Maven
[Junit] assertThat is(int) error
denodo
2014. 3. 28. 19:51
assertThat(name.length(), is(6))
assertThat 에서 지원하는 is() 메소드에서 int형을 parameter로 넣을 시, 에러나는 상황인데,
이부분은
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
위 패키지를 import 해주어야 한다.
Maven Spring dependency는 아래와 같이 추가하여야 한다.
JUnit - junit
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency>
Hamcrest Core - hamcrest-core
<dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.1</version> </dependency>
<dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> <version>1.1</version> </dependency>
maven 참고 url
http://mavenhub.com/c/org/hamcrest/corematchers/dependency