Skip to content

Commit

Permalink
! r can we use multiline strings
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsEckart committed Sep 23, 2024
1 parent d7721bb commit 04fe91a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -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:
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
3. Override Approvals.settings() with either
a. allowMultipleVerifyCallsForThisClass
b. allowMultipleVerifyCallsForThisMethod
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 8 additions & 0 deletions approvaltests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ public class ApprovalsDuplicateVerifyException extends RuntimeException
{
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("""
Already approved: %s
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""".formatted(file));;
}
}

0 comments on commit 04fe91a

Please sign in to comment.