시소당
다음과 같은 코드가 있다.
Dollar product = five.times(3);
assertEquals(new Dollar(15), product);
product는 추후 다시 쓰이지 않기 때문에 굳이 두 줄에 나눠서 표현할 필요가 없다. 이런 경우
Inline Method 리팩토링을 적용할 수 있다.
product를 더블클릭하고
alt+shift+I 단축키를 선택한다. 보다 정확하게 말하면, 블럭 안에 product가 포함되어 있으면 된다.
assertEquals(new Dollar(15), five.times(3));
간결하게 한 줄로 바뀐다.
출처 : http://younghoe.info/483