use of cucumber.api.spring.SpringTransactionHooks in project cucumber-jvm by cucumber.
the class SpringTransactionHooksTest method shouldObtainPlatformTransactionManagerByTypeWhenTxnManagerBeanNameNotSet.
@Test
public void shouldObtainPlatformTransactionManagerByTypeWhenTxnManagerBeanNameNotSet() {
SpringTransactionHooks localTarget = new SpringTransactionHooks();
localTarget.setBeanFactory(mockedBeanFactory);
when(mockedBeanFactory.getBean(PlatformTransactionManager.class)).thenReturn(mockedPlatformTransactionManager);
assertSame(localTarget.obtainPlatformTransactionManager(), mockedPlatformTransactionManager);
verify(mockedBeanFactory).getBean(PlatformTransactionManager.class);
}
use of cucumber.api.spring.SpringTransactionHooks in project cucumber-jvm by cucumber.
the class SpringTransactionHooksTest method shouldObtainPlatformTransactionManagerByNameWhenTxnManagerBeanNameIsSet.
@Test
public void shouldObtainPlatformTransactionManagerByNameWhenTxnManagerBeanNameIsSet() {
SpringTransactionHooks localTarget = new SpringTransactionHooks();
localTarget.setBeanFactory(mockedBeanFactory);
final String txnManagerBeanName = "myTxnManagerBeanName";
localTarget.setTxnManagerBeanName(txnManagerBeanName);
when(mockedBeanFactory.getBean(txnManagerBeanName, PlatformTransactionManager.class)).thenReturn(mockedPlatformTransactionManager);
assertSame(localTarget.obtainPlatformTransactionManager(), mockedPlatformTransactionManager);
verify(mockedBeanFactory).getBean(txnManagerBeanName, PlatformTransactionManager.class);
}
use of cucumber.api.spring.SpringTransactionHooks in project cucumber-jvm by cucumber.
the class SpringTransactionHooksTest method setUp.
@Before
public void setUp() {
target = new SpringTransactionHooks() {
@Override
public PlatformTransactionManager obtainPlatformTransactionManager() {
return mockedPlatformTransactionManager;
}
};
target.setBeanFactory(mockedBeanFactory);
}
Aggregations