diff --git a/approvaltests-tests/src/test/java/org/approvaltests/ApprovalsDuplicateVerifyExceptionTest.testExceptionMessage.approved.txt b/approvaltests-tests/src/test/java/org/approvaltests/ApprovalsDuplicateVerifyExceptionTest.testExceptionMessage.approved.txt index b468846fb..cf7e87f7e 100644 --- a/approvaltests-tests/src/test/java/org/approvaltests/ApprovalsDuplicateVerifyExceptionTest.testExceptionMessage.approved.txt +++ b/approvaltests-tests/src/test/java/org/approvaltests/ApprovalsDuplicateVerifyExceptionTest.testExceptionMessage.approved.txt @@ -1,11 +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 +org.approvaltests.ApprovalsDuplicateVerifyException: By default, ApprovalTests only allows one verify() call per test. +This file has already been approved: file.txt -# Fixes -1. separate your test into two tests -2. add NamedParameters with the NamerFactory -3. Override Approvals.settings() with either - a. allowMultipleVerifyCallsForThisClass - b. allowMultipleVerifyCallsForThisMethod \ No newline at end of file +You can do one of the following: + +* Separate your test into two tests +* Allow multiple verify calls inside one test class or method via: + - Approvals.settings().allowMultipleVerifyCallsForThisClass(); + - Approvals.settings().allowMultipleVerifyCallsForThisMethod(); +* Add NamedParameters with the NamerFactory + - visit https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md diff --git a/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java b/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java index 751c3afa1..a5f687c52 100644 --- a/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java +++ b/approvaltests-tests/src/test/java/org/approvaltests/inline/InlineApprovalsTest.java @@ -200,11 +200,11 @@ void testSemiAutomaticMessage() void testSemiAutomaticWithPreviousApproved() { var expected = """ - 42 - ***** DELETE ME TO APPROVE ***** - vvvvv PREVIOUS RESULT vvvvv - 41 - """; + 42 + ***** DELETE ME TO APPROVE ***** + vvvvv PREVIOUS RESULT vvvvv + 41 + """; var options = new Options().inline(expected, InlineOptions.semiAutomaticWithPreviousApproved()); try { diff --git a/approvaltests/src/main/java/org/approvaltests/ApprovalsDuplicateVerifyException.java b/approvaltests/src/main/java/org/approvaltests/ApprovalsDuplicateVerifyException.java index eb5119b5a..bdff78314 100644 --- a/approvaltests/src/main/java/org/approvaltests/ApprovalsDuplicateVerifyException.java +++ b/approvaltests/src/main/java/org/approvaltests/ApprovalsDuplicateVerifyException.java @@ -2,13 +2,22 @@ public class ApprovalsDuplicateVerifyException extends RuntimeException { + // @formatter:off 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\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"); + super( + "By default, ApprovalTests only allows one verify() call per test.\n" + + "This file has already been approved: " + file + "\n" + + "\n" + + "You can do one of the following:\n" + + "\n" + + "* Separate your test into two tests\n" + + "* Allow multiple verify calls inside one test class or method via:\n" + + "\t- Approvals.settings().allowMultipleVerifyCallsForThisClass();\n" + + "\t- Approvals.settings().allowMultipleVerifyCallsForThisMethod();\n" + + "* Add NamedParameters with the NamerFactory\n" + + "\t- visit https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/reference/Naming.md\n" + ); } + // @formatter:on }