public void testClass(Gson gson){
...
생성자(Environment env){}
}
@RunWith(MockitoJUnitRunner.class)
public class LocalTest{
TestClass testClass;
@Mock
Environment env;
@Before
public void setUp() {
testClass = new TestClass(env);
}
@Test
public void privateMethodCall_Test() {
Logger log = (Logger) LoggerFactory.getLogger(LocalTest.class);
try {
Class c = testclass.getClass();
Method method = c.getDeclaredMethod("ParseTest", Gson.class);
method.setAccessible(true);
Gson gson = new Gson();
String Result = (String) method.invoke(testClass, gson);
log.info(Result);
} catch (NoSuchMethodException e) {
log.info(e.toString());
}
}
}
'DEV > SpringFramework' 카테고리의 다른 글
Lombok 어노테이션 (0) | 2022.06.20 |
---|---|
[Spring] Build 후 실행 (0) | 2021.09.12 |
[Spring] application. properties 변수 맵핑 (0) | 2021.09.12 |
[Spring] Server 구축 [1] (0) | 2021.09.09 |