|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.extensions.cdi.jsf2.impl.scope.view.ViewScopedContext
org.apache.myfaces.extensions.cdi.jsf2.impl.scope.view.MockViewScopedContext
public class MockViewScopedContext
This is a Mock version of the ViewScopedContext
.
It will automatically get used instead of it's parent class
if we are in the
ProjectStage.UnitTest
.
There is of course no automatic cleaning if we transit over to the
next view! In this case you can use resetViewMap()
to clean
the mock ViewMap manually in your unit test.
Attention: The ViewMap is a shared static ConcurrentHashMap, so this implementation is not able to emulate the behaviour of multiple views at the same time!
Constructor Summary | |
---|---|
MockViewScopedContext()
|
Method Summary | |
---|---|
protected Map<String,Object> |
getViewMap()
|
boolean |
isActive()
The view context is active if a valid ViewRoot could be detected. |
static void |
resetViewMap()
Simply clear the mock ViewMap. |
Methods inherited from class org.apache.myfaces.extensions.cdi.jsf2.impl.scope.view.ViewScopedContext |
---|
get, get, getScope, getViewRoot, isListenerForSource, processEvent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockViewScopedContext()
Method Detail |
---|
public static void resetViewMap()
protected Map<String,Object> getViewMap()
getViewMap
in class ViewScopedContext
public boolean isActive()
ViewScopedContext
isActive
in interface javax.enterprise.context.spi.Context
isActive
in class ViewScopedContext
true
since in a unit test it's always active.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |