[펌]junit test.. eclipse에서 static import 쉽게하기

less than 1 minute read

출처 : http://toby.epril.com/?p=1126

static import를 위해서 Templates을 사용한다. Preference – Java – Editor 밑에 있는 Templates은 미리 간단한 이름를 정해놓고 이를 타이핑하고 ctrl-space를 누르면 미리 넣어둔 코드 조각(템플릿)이 한방에 나오는 기능이다. main은 main() 메소드를 만들 때 사용하고 sysout는 Sytem.out.println()을 만들어준다. 반복적으로 나오는 코드 패턴에 적용하기 좋다. 나는 여기에 ti라는 이름으로 다음과 같은 코드를 넣어놨다. ti는 test imports…

import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import static org.junit.matchers.JUnitMatchers.*; import static org.mockito.Matchers.*; import static org.mockito.Mockito.*;

 

자주 사용하는게 있다면 이런식으로 설정해놓으면 편리할 것 같다.