티스토리 뷰
누구냐 넌 import static!?
매번 Static 메서드의 클래스를 입력하지 않아도 되는 방법!, 아래 ModelAndViewAssert.assertViewName(...)
처럼.
... import static org.springframework.test.web.ModelAndViewAssert.*; ... @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/test.xml" }) public class ControllerTest { @Autowired private Controller controller; @Test public void viewNameTest() { ModelAndView mav = controller.index(); assertViewName(mav, "/main/index"); } }
static 메소드나 static 변수를 접근하기 위해 해당 클래스의 이름과 함께 써 주어야 한다. 하지만 유틸리티성 메소드나 상수의 경우 일일이 클래스 이름을 써주기 귀찮은 경우가 있는데 이 경우 static import를 사용하면 클래스 이름 없이 static 메소드나 static 변수 이름만으로 사용할 수 있다. Sigel's house made of ice 。。。블로그 본문
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 커피스크립트
- 스프링인액션
- REACTOR
- console
- 리액터
- gvim
- VIM
- maven
- React
- tipoftheday
- Configuration
- Java
- 빔
- 윈도우즈
- Coffeescript
- intellij
- VI
- 자바스크립트
- unit test
- Commonjs
- 리액티브프로그래밍
- Eclipse
- Node.js
- dojo
- Windows
- JavaScript
- 자바
- Widget
- Git
- reactiveprogramming
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함