Skip to content

Commit

Permalink
chore: cleanup deprecated constructor, all tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
abregar committed Feb 1, 2023
1 parent 1ee9248 commit 43e4945
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.jboss.arquillian.core.spi.EventContext;
import org.jboss.arquillian.core.spi.ServiceLoader;
import org.jboss.arquillian.test.spi.TestResult;
import org.jboss.arquillian.test.spi.TestResult.Status;
import org.jboss.arquillian.test.spi.event.suite.After;
import org.jboss.arquillian.test.spi.event.suite.Before;
import org.jboss.arquillian.test.spi.event.suite.TestEvent;
Expand Down Expand Up @@ -115,8 +116,7 @@ private void endTransaction(After afterTest) {
lifecycleEvent.fire(new BeforeTransactionEnded());

final TransactionProvider transactionProvider = transactionProviderInstance.get();
final TransactionalTest transactionalTest =
new DefaultTransactionalTest(getTransactionManager(afterTest));
final TransactionalTest transactionalTest = new DefaultTransactionalTest(getTransactionManager(afterTest));

if (rollbackRequired(afterTest)) {
transactionProvider.rollbackTransaction(transactionalTest);
Expand Down Expand Up @@ -158,14 +158,11 @@ private boolean rollbackRequired(TestEvent testEvent) {
* @return true if test requires rollback, false otherwise
*/
private boolean testRequiresRollbackDueToFailure() {
return false;
/*
if (testResultInstance.get() != null) {
final Status actualStatus = testResultInstance.get().getStatus();
return TestResult.Status.FAILED.equals(actualStatus);
}
return true;
*/
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void shouldRollbackTransaction() throws Exception {
Object instance = new TestClass();
Method testMethod = instance.getClass().getMethod("rollbackTest");

bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());

getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

Expand All @@ -258,7 +258,7 @@ public void shouldRollbackTransactionOnFail() throws Exception {
Object instance = new TestClass();
Method testMethod = instance.getClass().getMethod("failTest");

bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.FAILED));
bind(TestScoped.class, TestResult.class, TestResult.failed(null));

getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

Expand Down Expand Up @@ -300,7 +300,7 @@ public void shouldCommitTransactionWhenDefaultModeUsed() throws Exception {
Object instance = new TestClass();
Method testMethod = instance.getClass().getMethod("defaultTest");

bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());

getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

Expand All @@ -316,7 +316,7 @@ public void shouldCommitTransactionWhenDefaultModeUsed() throws Exception {
@Test
public void shouldActivateTransactionWhenRunAsClient() throws Exception {
when(mockDeploymentDescriptor.testable()).thenReturn(false);
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());

Object instance = new TestClass();
Method testMethod = instance.getClass().getMethod("commitTest");
Expand All @@ -329,7 +329,7 @@ public void shouldActivateTransactionWhenRunAsClient() throws Exception {
@Test
public void shouldActivateTransactionWhenLocalProtocol() throws Exception {
when(mockDeploymentDescriptor.testable()).thenReturn(true);
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());

Container container = Mockito.mock(Container.class);
DeployableContainer deployableContainer = Mockito.mock(DeployableContainer.class);
Expand All @@ -348,7 +348,7 @@ public void shouldActivateTransactionWhenLocalProtocol() throws Exception {
@Test
public void shouldActivateTransactionWhenRunAsClientAndLocalProtocol() throws Exception {
when(mockDeploymentDescriptor.testable()).thenReturn(false);
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());

Container container = Mockito.mock(Container.class);
DeployableContainer deployableContainer = Mockito.mock(DeployableContainer.class);
Expand All @@ -367,7 +367,7 @@ public void shouldActivateTransactionWhenRunAsClientAndLocalProtocol() throws Ex
@Test
public void shouldNotActivateTransactionWhenNotRunAsClientOnClientSide() throws Exception {
when(mockDeploymentDescriptor.testable()).thenReturn(true);
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());

Object instance = new TestClass();
Method testMethod = instance.getClass().getMethod("commitTest");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void should_have_transaction_enabled_in_commit_when_defined_on_method_lev

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -151,7 +151,7 @@ public void should_have_transaction_enabled_in_commit_when_defined_on_method_lev

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -167,7 +167,7 @@ public void should_rollback_when_test_failed() throws Exception {

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.FAILED));
bind(TestScoped.class, TestResult.class, TestResult.failed(null));
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -186,7 +186,7 @@ public void should_have_transaction_enabled_in_rollback_when_defined_on_method_l

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -202,7 +202,7 @@ public void should_have_transaction_enabled_in_rollback_when_defined_on_method_l

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -218,7 +218,7 @@ public void should_have_transaction_disabled_when_defined_on_method_level_using_

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -236,7 +236,7 @@ public void should_commit_transaction_when_globally_defined_on_class_level_using

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -252,7 +252,7 @@ public void should_have_transaction_disabed_when_globally_enabled_on_class_level

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand All @@ -267,7 +267,7 @@ public void should_have_transaction_disabled_when_not_defined() throws Exception

// when
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.Before(instance, testMethod));
bind(TestScoped.class, TestResult.class, new TestResult(TestResult.Status.PASSED));
bind(TestScoped.class, TestResult.class, TestResult.passed());
getManager().fire(new org.jboss.arquillian.test.spi.event.suite.After(instance, testMethod));

// then
Expand Down

0 comments on commit 43e4945

Please sign in to comment.