请问一下如何mock网络response?

如何mock网络response


慕勒3428872
浏览 1459回答 4
4回答

慕斯709654

在servlet中有以下两种方法: public void doGet(HttpServletRequest request, HttpServletResponse response) public void doPost(HttpServletRequest request, HttpServletResponse response) 可以直接使用request和response不需要创建的!

扬帆大鱼

传统的JMock是无法Mock静态方法的,但是Jmockit能够很好地Mock类的静态方法。[java] view plain copypackage features.jmockit.staticmock;public class StaticTarget {public static int m1() {throw new RuntimeException();}public static String m2() {throw new RuntimeException();}}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java
CSS3