aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0257-Better-AnnotationTest-printout.patch
blob: 0d2e5026a4876a49bf56ec237cc88f022f2894d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 3 Dec 2020 14:04:57 -0800
Subject: [PATCH] Better AnnotationTest printout


diff --git a/pom.xml b/pom.xml
index de6a5b697535b9532fee1521363432c76c233952..e66661eb84308dc13faa0d39b7487f40c1180443 100644
--- a/pom.xml
+++ b/pom.xml
@@ -237,6 +237,19 @@
                     <shadedArtifactAttached>true</shadedArtifactAttached>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.22.2</version>
+                <configuration>
+                    <properties>
+                        <property>
+                            <name>listener</name>
+                            <value>io.papermc.paper.JunitEventListener</value>
+                        </property>
+                    </properties>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
diff --git a/src/test/java/io/papermc/paper/JunitEventListener.java b/src/test/java/io/papermc/paper/JunitEventListener.java
new file mode 100644
index 0000000000000000000000000000000000000000..072ac1a96394b8d494f42fca8dfe08115eaed3fe
--- /dev/null
+++ b/src/test/java/io/papermc/paper/JunitEventListener.java
@@ -0,0 +1,6 @@
+package io.papermc.paper;
+
+import org.junit.runner.notification.RunListener;
+
+public class JunitEventListener extends RunListener {
+}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 03229d5f4ec36a82197beb391356d791ff67fb2f..19271057cf24329757c9419fa6c97848e008a96c 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -107,13 +107,18 @@ public class AnnotationTest {
 
         Collections.sort(errors);
 
-        System.out.println(errors.size() + " missing annotation(s):");
+        StringBuilder builder = new StringBuilder()
+            .append("There ")
+            .append(errors.size() != 1 ? "are " : "is ")
+            .append(errors.size())
+            .append(" missing annotation")
+            .append(errors.size() != 1 ? "s:\n" : ":\n");
+
         for (String message : errors) {
-            System.out.print("\t");
-            System.out.println(message);
+            builder.append("\t").append(message).append("\n");
         }
 
-        Assert.fail("There " + errors.size() + " are missing annotation(s)");
+        Assert.fail(builder.toString());
     }
 
     private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {