Skip to content

Commit 5c14ceb

Browse files
author
Nicolai Parlog
committed
Don't mention that a test passes in its name (that's the default, right?!)
1 parent 21a0e3b commit 5c14ceb

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

src/test/java/org/codefx/demo/junit5/basics/AssertTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class AssertTest {
2222

2323
@Test
24-
void assertWithBoolean_pass() {
24+
void assertWithBoolean() {
2525
assertTrue(true);
2626
assertTrue(this::truism);
2727

@@ -33,7 +33,7 @@ private boolean truism() {
3333
}
3434

3535
@Test
36-
void assertWithComparison_pass() {
36+
void assertWithComparison() {
3737
List<String> expected = asList("element");
3838
List<String> actual = new LinkedList<>(expected);
3939

@@ -74,7 +74,7 @@ private Address(String city, String street, String number) {
7474
}
7575

7676
@Test
77-
void assertExceptions_pass() {
77+
void assertExceptions() {
7878
Exception exception = assertThrows(Exception.class, this::throwing);
7979
assertEquals("I'm failing on purpose.", exception.getMessage());
8080
}

src/test/java/org/codefx/demo/junit5/dynamic/ArithmeticTreeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private static DynamicNode generateTestTreeFor(
4141
else {
4242
var testsForChildren = generateTestsFor(arithmeticNode.operands(), treeTestData);
4343
var expected = treeTestData.resultFor(arithmeticNode);
44-
var testName = arithmeticNode + " should evaluate to " + expected;
44+
var testName = arithmeticNode + " should evaluate to " + expected + " (ops '+3' and '*10' fail)";
4545
return dynamicContainer(testName, concat(of(testForNode), testsForChildren));
4646
}
4747
}

src/test/java/org/codefx/demo/junit5/dynamic/ArithmeticTreeTestData.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ static ArithmeticTreeTestData generateRandom() {
7373
}
7474

7575
private static ArithmeticNode[] pickRandomNodes(List<ArithmeticNode> nodes, Random random) {
76-
77-
7876
return IntStream.range(0, random.nextInt(3) + 2)
7977
// compute a random index
8078
.map(n -> random.nextInt(nodes.size()))

src/test/java/org/codefx/demo/junit5/extensions/ExpectedExceptionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class ExpectedExceptionTest {
66

77
@Test
8-
void noExceptionExpected_throwsNoException_passes() {
8+
void noExceptionExpected_throwsNoException() {
99
// do nothing
1010
}
1111

@@ -20,7 +20,7 @@ void exceptionExpected_throwsNoException_fails() {
2020
}
2121

2222
@Test(expected = IndexOutOfBoundsException.class)
23-
void exceptionExpected_throwsException_passes() {
23+
void exceptionExpected_throwsException() {
2424
throw new IndexOutOfBoundsException("I'm failing on purpose.");
2525
}
2626

src/test/java/org/codefx/demo/junit5/extensions/TimeoutTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
class TimeoutTest {
88

99
@Test
10-
void quickTestWithoutTimeout_testPasses() {
10+
void quickTestWithoutTimeout() {
1111
assertTrue(true);
1212
}
1313

1414
@Test(timeout = 0)
15-
void quickTestWithoutZeroTimeout_testPasses() {
15+
void quickTestWithoutZeroTimeout() {
1616
assertTrue(true);
1717
}
1818

1919
@Test(timeout = 10_000)
20-
void quickTestWithoutVeryLargeTimeout_testPasses() {
20+
void quickTestWithoutVeryLargeTimeout() {
2121
assertTrue(true);
2222
}
2323

0 commit comments

Comments
 (0)