⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mockpagecontext.java

📁 软件测试经典书籍<<Junit in action>>里的源代码。
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
   public void setupGetException(Exception arg){
      myActualGetExceptionReturnValues.add(arg);
   }
   public void setExpectedGetServletConfigCalls(int calls){
      myGetServletConfigCalls.setExpected(calls);
   }
   public ServletConfig getServletConfig(){
      myGetServletConfigCalls.inc();
      Object nextReturnValue = myActualGetServletConfigReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
      return (ServletConfig) nextReturnValue;
   }
   public void setupExceptionGetServletConfig(Throwable arg){
      myActualGetServletConfigReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setupGetServletConfig(ServletConfig arg){
      myActualGetServletConfigReturnValues.add(arg);
   }
   public void setExpectedGetServletContextCalls(int calls){
      myGetServletContextCalls.setExpected(calls);
   }
   public ServletContext getServletContext(){
      myGetServletContextCalls.inc();
      Object nextReturnValue = myActualGetServletContextReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
      return (ServletContext) nextReturnValue;
   }
   public void setupExceptionGetServletContext(Throwable arg){
      myActualGetServletContextReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setupGetServletContext(ServletContext arg){
      myActualGetServletContextReturnValues.add(arg);
   }
   public void setExpectedForwardCalls(int calls){
      myForwardCalls.setExpected(calls);
   }
   public void addExpectedForwardValues(String arg0){
      myForwardParameter0Values.addExpected(arg0);
   }
   public void forward(String arg0) throws ServletException, IOException{
      myForwardCalls.inc();
      myForwardParameter0Values.addActual(arg0);
      Object nextReturnValue = myActualForwardReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof ServletException)
          throw (ServletException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof IOException)
          throw (IOException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
   }
   public void setupExceptionForward(Throwable arg){
      myActualForwardReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setExpectedIncludeCalls(int calls){
      myIncludeCalls.setExpected(calls);
   }
   public void addExpectedIncludeValues(String arg0){
      myIncludeParameter0Values.addExpected(arg0);
   }
   public void include(String arg0) throws ServletException, IOException{
      myIncludeCalls.inc();
      myIncludeParameter0Values.addActual(arg0);
      Object nextReturnValue = myActualIncludeReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof ServletException)
          throw (ServletException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof IOException)
          throw (IOException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
   }
   public void setupExceptionInclude(Throwable arg){
      myActualIncludeReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setExpectedHandlePageExceptionExceptionCalls(int calls){
      myHandlePageExceptionExceptionCalls.setExpected(calls);
   }
   public void addExpectedHandlePageExceptionExceptionValues(Exception arg0){
      myHandlePageExceptionExceptionParameter0Values.addExpected(arg0);
   }
   public void handlePageException(Exception arg0) throws ServletException, IOException{
      myHandlePageExceptionExceptionCalls.inc();
      myHandlePageExceptionExceptionParameter0Values.addActual(arg0);
      Object nextReturnValue = myActualHandlePageExceptionExceptionReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof ServletException)
          throw (ServletException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof IOException)
          throw (IOException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
   }
   public void setupExceptionHandlePageExceptionException(Throwable arg){
      myActualHandlePageExceptionExceptionReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setExpectedHandlePageExceptionThrowableCalls(int calls){
      myHandlePageExceptionThrowableCalls.setExpected(calls);
   }
   public void addExpectedHandlePageExceptionThrowableValues(Throwable arg0){
      myHandlePageExceptionThrowableParameter0Values.addExpected(arg0);
   }
   public void handlePageException(Throwable arg0) throws ServletException, IOException{
      myHandlePageExceptionThrowableCalls.inc();
      myHandlePageExceptionThrowableParameter0Values.addActual(arg0);
      Object nextReturnValue = myActualHandlePageExceptionThrowableReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof ServletException)
          throw (ServletException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof IOException)
          throw (IOException)((ExceptionalReturnValue)nextReturnValue).getException();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
   }
   public void setupExceptionHandlePageExceptionThrowable(Throwable arg){
      myActualHandlePageExceptionThrowableReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setExpectedPushBodyCalls(int calls){
      myPushBodyCalls.setExpected(calls);
   }
   public BodyContent pushBody(){
      myPushBodyCalls.inc();
      Object nextReturnValue = myActualPushBodyReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
      return (BodyContent) nextReturnValue;
   }
   public void setupExceptionPushBody(Throwable arg){
      myActualPushBodyReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setupPushBody(BodyContent arg){
      myActualPushBodyReturnValues.add(arg);
   }
   public void setExpectedPopBodyCalls(int calls){
      myPopBodyCalls.setExpected(calls);
   }
   public JspWriter popBody(){
      myPopBodyCalls.inc();
      Object nextReturnValue = myActualPopBodyReturnValues.getNext();
      if (nextReturnValue instanceof ExceptionalReturnValue && ((ExceptionalReturnValue)nextReturnValue).getException() instanceof RuntimeException)
          throw (RuntimeException)((ExceptionalReturnValue)nextReturnValue).getException();
      return (JspWriter) nextReturnValue;
   }
   public void setupExceptionPopBody(Throwable arg){
      myActualPopBodyReturnValues.add(new ExceptionalReturnValue(arg));
   }
   public void setupPopBody(JspWriter arg){
      myActualPopBodyReturnValues.add(arg);
   }
   public void verify(){
      myInitializeCalls.verify();
      myInitializeParameter0Values.verify();
      myInitializeParameter1Values.verify();
      myInitializeParameter2Values.verify();
      myInitializeParameter3Values.verify();
      myInitializeParameter4Values.verify();
      myInitializeParameter5Values.verify();
      myInitializeParameter6Values.verify();
      myReleaseCalls.verify();
      mySetAttributeStringObjectCalls.verify();
      mySetAttributeStringObjectParameter0Values.verify();
      mySetAttributeStringObjectParameter1Values.verify();
      mySetAttributeStringObjectIntCalls.verify();
      mySetAttributeStringObjectIntParameter0Values.verify();
      mySetAttributeStringObjectIntParameter1Values.verify();
      mySetAttributeStringObjectIntParameter2Values.verify();
      myGetAttributeStringCalls.verify();
      myGetAttributeStringParameter0Values.verify();
      myGetAttributeStringIntCalls.verify();
      myGetAttributeStringIntParameter0Values.verify();
      myGetAttributeStringIntParameter1Values.verify();
      myFindAttributeCalls.verify();
      myFindAttributeParameter0Values.verify();
      myRemoveAttributeStringCalls.verify();
      myRemoveAttributeStringParameter0Values.verify();
      myRemoveAttributeStringIntCalls.verify();
      myRemoveAttributeStringIntParameter0Values.verify();
      myRemoveAttributeStringIntParameter1Values.verify();
      myGetAttributesScopeCalls.verify();
      myGetAttributesScopeParameter0Values.verify();
      myGetAttributeNamesInScopeCalls.verify();
      myGetAttributeNamesInScopeParameter0Values.verify();
      myGetOutCalls.verify();
      myGetSessionCalls.verify();
      myGetPageCalls.verify();
      myGetRequestCalls.verify();
      myGetResponseCalls.verify();
      myGetExceptionCalls.verify();
      myGetServletConfigCalls.verify();
      myGetServletContextCalls.verify();
      myForwardCalls.verify();
      myForwardParameter0Values.verify();
      myIncludeCalls.verify();
      myIncludeParameter0Values.verify();
      myHandlePageExceptionExceptionCalls.verify();
      myHandlePageExceptionExceptionParameter0Values.verify();
      myHandlePageExceptionThrowableCalls.verify();
      myHandlePageExceptionThrowableParameter0Values.verify();
      myPushBodyCalls.verify();
      myPopBodyCalls.verify();
   }
public MockPageContext(){
   super();
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -