Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
markusheiden committed Mar 19, 2024
1 parent f7c137d commit 6ec502e
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void labelsAreApplied() {
}

/**
* Test that transaction attribute is inherited from class
* Test that transaction attribute is inherited from class declaring the method
* if not specified on method.
*/
@Test
Expand All @@ -189,6 +189,17 @@ void defaultsToClassTransactionAttribute() {
new NoRollbackRuleAttribute(IOException.class)));
}

/**
* Test that transaction attribute is inherited from the target class
* if not specified on method.
*/
@Test
void defaultsToTargetClassTransactionAttribute() {
TransactionAttribute actual = getTransactionAttribute(TestBean4.class, TestBean12.class, "getAge");
assertThat(actual).satisfies(hasRollbackRules(new RollbackRuleAttribute(Exception.class),
new NoRollbackRuleAttribute(IOException.class)));
}

@Test
void customClassAttributeDetected() {
TransactionAttribute actual = getTransactionAttribute(TestBean5.class, "getAge");
Expand Down Expand Up @@ -932,4 +943,9 @@ public int getAge() {
}
}


@Transactional
static class TestBean12 extends Empty {
}

}

0 comments on commit 6ec502e

Please sign in to comment.