ordered.verify(session).enableFilter("myFilter");
}
@Test
public void testExecuteWithThreadBoundAndParameterizedExistingFilter() {
Filter filter = mock(Filter.class);
given(session.isOpen()).willReturn(true);
given(session.enableFilter("myFilter")).willReturn(filter);
hibernateTemplate.setAllowCreate(false);
hibernateTemplate.setFilterName("myFilter");
TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session));
try {
final List l = new ArrayList();
l.add("test");
Filter f = hibernateTemplate.enableFilter("myFilter");
assertTrue("Correct filter", f == filter);
}
finally {
TransactionSynchronizationManager.unbindResource(sessionFactory);
}