use of org.dbflute.mock.MockOutsideSqlContext in project dbflute-core by dbflute.
the class BehaviorCommandInvokerTest method test_clearContext.
public void test_clearContext() {
// ## Arrange ##
BehaviorCommandInvoker invoker = new BehaviorCommandInvoker();
OutsideSqlContext.setOutsideSqlContextOnThread(new MockOutsideSqlContext());
FetchAssistContext.setFetchBeanOnThread(new MockConditionBean());
ConditionBeanContext.setConditionBeanOnThread(new MockConditionBean());
ConditionBeanContext.setEntityRowHandlerOnThread(new EntityRowHandler<Entity>() {
public void handle(Entity entity) {
}
});
InternalMapContext.setObject("dummy", new Object());
ResourceContext.setResourceContextOnThread(new ResourceContext());
assertTrue(OutsideSqlContext.isExistOutsideSqlContextOnThread());
assertTrue(FetchAssistContext.isExistFetchNarrowingBeanOnThread());
assertTrue(ConditionBeanContext.isExistConditionBeanOnThread());
assertTrue(ConditionBeanContext.isExistEntityRowHandlerOnThread());
assertTrue(InternalMapContext.isExistInternalMapContextOnThread());
assertTrue(ResourceContext.isExistResourceContextOnThread());
// ## Act ##
invoker.clearAllCurrentContext();
// ## Assert ##
assertFalse(OutsideSqlContext.isExistOutsideSqlContextOnThread());
assertFalse(FetchAssistContext.isExistFetchNarrowingBeanOnThread());
assertFalse(ConditionBeanContext.isExistConditionBeanOnThread());
assertFalse(ConditionBeanContext.isExistEntityRowHandlerOnThread());
assertFalse(InternalMapContext.isExistInternalMapContextOnThread());
assertFalse(ResourceContext.isExistResourceContextOnThread());
}
Aggregations