@@ -0,0 +1,1066 @@
+import javax.servlet.*;  %0Aimport javax.servlet.http.*;  %0Aimport org.easymock.*;  %0A  %0Apublic class LoginServletTest %7B  %0A  // %E6%B5%8B%E8%AF%95%E7%99%BB%E9%99%86%E5%A4%B1%E8%B4%A5  %0A  @Test  %0A   public void testLoginFailed() throws Exception %7B  %0A        // %E4%BD%BF%E7%94%A8 EasyMock %E7%94%9F%E6%88%90 Mock %E5%AF%B9%E8%B1%A1%EF%BC%9B  %0A        MockControl mc = MockControl.createControl(HttpServletRequest.class);  %0A        HttpServletRequest request = (HttpServletRequest)mc.getMock();  %0A        // %E8%AE%BE%E5%AE%9A Mock %E5%AF%B9%E8%B1%A1%E7%9A%84%E9%A2%84%E6%9C%9F%E8%A1%8C%E4%B8%BA%E5%92%8C%E8%BE%93%E5%87%BA%EF%BC%9B  %0A        request.getParameter(%22username%22);  %0A        mc.setReturnValue(%22admin%22, 1);  %0A        request.getParameter(%22password%22);  %0A        mc.setReturnValue(%221234%22, 1);  %0A        // %E5%B0%86 Mock %E5%AF%B9%E8%B1%A1%E5%88%87%E6%8D%A2%E5%88%B0 Replay %E7%8A%B6%E6%80%81%EF%BC%9B  %0A        mc.replay();  %0A        // now start test:  %0A        LoginServlet servlet = new LoginServlet();  %0A        try %7B  %0A              // %E9%87%8C%E9%9D%A2%E4%BC%9A%E8%B0%83%E7%94%A8 Mock %E5%AF%B9%E8%B1%A1%E6%96%B9%E6%B3%95%E8%BF%9B%E8%A1%8C%E5%8D%95%E5%85%83%E6%B5%8B%E8%AF%95%EF%BC%9B  %0A            servlet.doPost(request, null);  %0A            fail(%22Not caught exception!%22);  %0A        %7D  %0A        catch(RuntimeException re) %7B  %0A            assertEquals(%22Login failed.%22, re.getMessage());  %0A        %7D  %0A        // %E5%AF%B9 Mock %E5%AF%B9%E8%B1%A1%E7%9A%84%E8%A1%8C%E4%B8%BA%E8%BF%9B%E8%A1%8C%E9%AA%8C%E8%AF%81%E3%80%82  %0A        mc.verify();  %0A    %7D  %0A

Create LoginServletTest.java