Skip to content

Commit

Permalink
! F added better help message
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsEckart committed Sep 11, 2023
1 parent 6f3e863 commit 0feac60
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.approvaltests;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class ApprovalsDuplicateVerifyExceptionTest {

@Test
void testExceptionMessage() {
Approvals.verify(new ApprovalsDuplicateVerifyException("file.txt"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
org.approvaltests.ApprovalsDuplicateVerifyException: Already approved: file.txt
By default, ApprovalTests only allows one verify() call per test.
To find out more, visit:
https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md

# Fixes
1. separate your test into two tests
2. add NamedParameters with the NamerFactory
3. Override Approvals.settings() with either
a. allowMultipleVerifyCallsForThisClass
b. allowMultipleVerifyCallsForThisMethod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ public ApprovalsDuplicateVerifyException(String file)
{
super("Already approved: " + file + "\n"
+ "By default, ApprovalTests only allows one verify() call per test.\n" + "To find out more, visit: \n"
+ "https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md");
+ "https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md\n\n" +
"# Fixes\n" +
"1. separate your test into two tests\n" +
"2. add NamedParameters with the NamerFactory\n" +
"3. Override Approvals.settings() with either \n" +
"\ta. allowMultipleVerifyCallsForThisClass\n" +
"\tb. allowMultipleVerifyCallsForThisMethod");
}
}

0 comments on commit 0feac60

Please sign in to comment.