AAAAServlet.java:
protected void execute(HttpServletRequest req, HttpServletResponse res, DataSource ds) {************}
AAAAServlet.javaをテスト
Class<? extends Object> clazz = AAAAServlet.class;
Method method = clazz.getDeclaredMethod("execute", HttpServletRequest.class, HttpServletResponse.class, DataSource.class);
method.setAccessible(true);
MockRequest req = new MockRequest();
req.setParameter(key, value);
MockResponse res = new MockResponse();
method.invoke(new AAAAServlet(), req, res, ds);
assertEquals(actualValue, res.getDocument());
时间: 2024-11-07 05:05:25