1 /*
 2  * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.  Oracle designates this
 8  * particular file as subject to the "Classpath" exception as provided
 9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 package hat.test.engine;
26 
27 public class HATTestFormatter {
28 
29     public static void appendClass(StringBuilder builder, String className) {
30         builder.append(Colours.CYAN)
31                 .append("Class: ")
32                 .append(className)
33                 .append(Colours.RESET)
34                 .append("\n");;
35     }
36 
37     public static void testing(StringBuilder builder, String methodName) {
38         builder.append(Colours.BLUE)
39                 .append(String.format("Testing: #%-30s", methodName))
40                 .append(String.format("%-20s", "..................... "))
41                 .append(Colours.RESET);
42     }
43 
44     public static void ok(StringBuilder builder) {
45         builder.append(Colours.GREEN)
46                 .append("[ok]")
47                 .append(Colours.RESET)
48                 .append("\n");;
49     }
50 
51     public static void fail(StringBuilder builder) {
52         builder.append(Colours.RED)
53                 .append("[fail]")
54                 .append(Colours.RESET)
55                 .append("\n");;
56     }
57 
58     public static void expectedToFail(StringBuilder builder, String reason) {
59         builder.append(Colours.YELLOW)
60                 .append("[FAIL][EXPECTED]")
61                 .append(Colours.RED)
62                 .append(" Reason: ")
63                 .append(reason)
64                 .append(Colours.RESET)
65                 .append("\n");;
66     }
67 
68     public static void failWithReason(StringBuilder builder, String reason) {
69         builder.append(Colours.RED)
70                 .append("[fail]")
71                 .append(Colours.YELLOW)
72                 .append(" Reason: ")
73                 .append(reason)
74                 .append(Colours.RESET)
75                 .append("\n");;
76     }
77 
78     public static void illegal(StringBuilder builder) {
79         builder.append(Colours.YELLOW)
80                 .append("[illegal]")
81                 .append(Colours.RESET)
82                 .append("\n");;
83     }
84 
85 }