Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- web.xml
- profile
- maVen
- 줄바꿈 문자
- import
- resource
- port
- vscode
- context
- netsh
- Quartz
- 네트워크
- plugin
- JavaScript
- Windows
- GIT
- Mac
- IntelliJ
- Eclipse
- ssh
- 단축키
- find
- xargs
- grep
- lsof
- bash
- VirtualBox
- Windows 10
- Source
- tomcat
Archives
- Today
- Total
develog
[java] private method test 본문
- ReflectionTestUtils.invokeMethod 를 사용
import org.springframework.test.util.ReflectionTestUtils;
@Test
public void privateMethodTest() {
MemberDto memberDto = new MemberDto();
ReflectionTestUtils.invokeMethod(memberDto, "setName", "hello");
String name = memberDto.getName();
System.out.println("name = " + name); // name = hello
}
public class MemberDto {
private String name;
private void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
Comments