Remove clashing error prefix; Use better name for RatufaCoat ROMs.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / util / TestResultOutputStream.java
blobeab0c872fb04d8fe006e413810935c81e34a2422
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // Multi-Phasic Applications: SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.plugin.util;
12 import cc.squirreljme.plugin.multivm.VMTestFrameworkTestClassProcessor;
13 import java.util.concurrent.atomic.AtomicReference;
14 import org.gradle.api.internal.tasks.testing.DefaultTestOutputEvent;
15 import org.gradle.api.internal.tasks.testing.TestResultProcessor;
16 import org.gradle.api.tasks.testing.TestOutputEvent;
18 /**
19 * Pushes lines to result output.
21 * @since 2022/09/11
23 public class TestResultOutputStream
24 extends LinePushOutputStream
26 /** Line ending character. */
27 public static final String LINE_ENDING =
28 System.getProperty("line.separator");
30 /** The destination output. */
31 protected final TestOutputEvent.Destination destination;
33 /** The test ID. */
34 protected final Object id;
36 /** The processor for test results. */
37 protected final AtomicReference<TestResultProcessor> processor;
39 /**
40 * Initializes the output stream for test result output.
42 * @param __processor The processor for test results.
43 * @param __id The test ID.
44 * @param __destination The processor for test results.
45 * @throws NullPointerException On null arguments.
46 * @since 2022/09/11
48 public TestResultOutputStream(
49 AtomicReference<TestResultProcessor> __processor, Object __id,
50 TestOutputEvent.Destination __destination)
51 throws NullPointerException
53 if (__processor == null || __id == null || __destination == null)
54 throw new NullPointerException("NARG");
56 this.processor = __processor;
57 this.id = __id;
58 this.destination = __destination;
61 /**
62 * {@inheritDoc}
63 * @since 2022/09/11
65 @Override
66 protected void push(String __string)
68 Object id = this.id;
69 TestOutputEvent.Destination destination = this.destination;
71 // Output string and the line ending
72 VMTestFrameworkTestClassProcessor.resultAction(this.processor,
73 (__rp) -> __rp.output(id, new DefaultTestOutputEvent(destination,
74 __string + TestResultOutputStream.LINE_ENDING)));