@Test(expected = IllegalArgumentException.class) public void testSetApplicationContextIllegal() { ApplicationContext applicationContext = createMock(ApplicationContext.class); Integer servletContext = new Integer(1); expect(applicationContext.getContext()).andReturn(servletContext); replay(applicationContext); try { JspExpressionFactoryFactory factory = new JspExpressionFactoryFactory(); factory.setApplicationContext(applicationContext); } finally { verify(applicationContext); } }
public void setApplicationContext(ApplicationContext applicationContext) { Object context = applicationContext.getContext(); if (context instanceof ServletContext) { this.servletContext = (ServletContext) context; } else { throw new IllegalArgumentException( "The application context does not hold an instance of " + "ServletContext, consider using JuelExpressionFactoryFactory"); } }
JspExpressionFactoryFactory implements ExpressionFactoryFactory,
        ApplicationContextAware { public void setApplicationContext(ApplicationContext applicationContext) { Object context = applicationContext.getContext(); if (context instanceof ServletContext) { this.servletContext = (ServletContext) context; } else { throw new IllegalArgumentException( "The application context does not hold an instance of " + "ServletContext, consider using JuelExpressionFactoryFactory"); } } }
JspExpressionFactoryFactory implements ExpressionFactoryFactory,
        ApplicationContextAware { public void setApplicationContext(ApplicationContext applicationContext) { Object context = applicationContext.getContext(); if (context instanceof ServletContext) { this.servletContext = (ServletContext) context; } else { throw new IllegalArgumentException( "The application context does not hold an instance of " + "ServletContext, consider using JuelExpressionFactoryFactory"); } }  }
JspExpressionFactoryFactory implements ExpressionFactoryFactory,
        ApplicationContextAware { public void setApplicationContext(ApplicationContext applicationContext) { Object context = applicationContext.getContext(); if (context instanceof ServletContext) { this.servletContext = (ServletContext) context; } else { throw new IllegalArgumentException( "The application context does not hold an instance of " + "ServletContext, consider using JuelExpressionFactoryFactory"); } }  void setApplicationContext(ApplicationContext applicationContext); ExpressionFactory getExpressionFactory(); }
JspExpressionFactoryFactory implements ExpressionFactoryFactory,
        ApplicationContextAware { public void setApplicationContext(ApplicationContext applicationContext) { Object context = applicationContext.getContext(); if (context instanceof ServletContext) { this.servletContext = (ServletContext) context; } else { throw new IllegalArgumentException( "The application context does not hold an instance of " + "ServletContext, consider using JuelExpressionFactoryFactory"); } }  void setApplicationContext(ApplicationContext applicationContext); ExpressionFactory getExpressionFactory();  }