Skip to content

Commit 0feac60

Browse files
committed
! F added better help message
1 parent 6f3e863 commit 0feac60

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.approvaltests;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.*;
6+
7+
class ApprovalsDuplicateVerifyExceptionTest {
8+
9+
@Test
10+
void testExceptionMessage() {
11+
Approvals.verify(new ApprovalsDuplicateVerifyException("file.txt"));
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
org.approvaltests.ApprovalsDuplicateVerifyException: Already approved: file.txt
2+
By default, ApprovalTests only allows one verify() call per test.
3+
To find out more, visit:
4+
https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md
5+
6+
# Fixes
7+
1. separate your test into two tests
8+
2. add NamedParameters with the NamerFactory
9+
3. Override Approvals.settings() with either
10+
a. allowMultipleVerifyCallsForThisClass
11+
b. allowMultipleVerifyCallsForThisMethod

approvaltests/src/main/java/org/approvaltests/ApprovalsDuplicateVerifyException.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ public ApprovalsDuplicateVerifyException(String file)
66
{
77
super("Already approved: " + file + "\n"
88
+ "By default, ApprovalTests only allows one verify() call per test.\n" + "To find out more, visit: \n"
9-
+ "https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md");
9+
+ "https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md\n\n" +
10+
"# Fixes\n" +
11+
"1. separate your test into two tests\n" +
12+
"2. add NamedParameters with the NamerFactory\n" +
13+
"3. Override Approvals.settings() with either \n" +
14+
"\ta. allowMultipleVerifyCallsForThisClass\n" +
15+
"\tb. allowMultipleVerifyCallsForThisMethod");
1016
}
1117
}

0 commit comments

Comments
 (0)