runtimeConfig.addManagedBean("beanInCustomScope", beanInCustomScope);
// resolve the managed bean
try
{
new MockValueExpression("#{beanInCustomScope}", List.class)
.getValue(facesContext.getELContext());
}
catch (FacesException fe)
{
// the message must contain ...
final String message = fe.getMessage();
// ... the expression string
assertTrue(message.contains(beanInCustomScope.getManagedBeanScope()));
Object resolvedScopeBean = new MockValueExpression("#{scopeBean}", List.class)
.getValue(facesContext.getELContext());
// ... the toString() of the value
assertTrue(message.contains(resolvedScopeBean.toString()));
// ... and the type of the value
assertTrue(message.contains(resolvedScopeBean.getClass().getName()));