|
| 1 | +/** |
| 2 | + * ContainerProxy |
| 3 | + * |
| 4 | + * Copyright (C) 2016-2021 Open Analytics |
| 5 | + * |
| 6 | + * =========================================================================== |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the Apache License as published by |
| 10 | + * The Apache Software Foundation, either version 2 of the License, or |
| 11 | + * (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * Apache License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the Apache License |
| 19 | + * along with this program. If not, see <http://www.apache.org/licenses/> |
| 20 | + */ |
| 21 | +package eu.openanalytics.containerproxy.test.helpers; |
| 22 | + |
| 23 | +import org.junit.platform.engine.TestExecutionResult; |
| 24 | +import org.junit.platform.launcher.TestIdentifier; |
| 25 | +import org.junit.platform.launcher.listeners.SummaryGeneratingListener; |
| 26 | + |
| 27 | +public class TestExecutionListener extends SummaryGeneratingListener { |
| 28 | + |
| 29 | + public TestExecutionListener() { |
| 30 | + |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
| 34 | + public void executionSkipped(TestIdentifier testIdentifier, String reason) { |
| 35 | + super.executionSkipped(testIdentifier, reason); |
| 36 | + if (testIdentifier == null || reason == null || !testIdentifier.isTest()) return; |
| 37 | + |
| 38 | + System.out.println(); |
| 39 | + System.out.printf("\t\t--> Skipping test \"%s\"%n", testIdentifier.getDisplayName()); |
| 40 | + System.out.println(); |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public void executionStarted(TestIdentifier testIdentifier) { |
| 45 | + super.executionStarted(testIdentifier); |
| 46 | + if (testIdentifier == null || !testIdentifier.isTest()) return; |
| 47 | + |
| 48 | + System.out.println(); |
| 49 | + System.out.printf("\t\t--> Started test \"%s\"%n", testIdentifier.getDisplayName()); |
| 50 | + System.out.println(); |
| 51 | + } |
| 52 | + |
| 53 | + @Override |
| 54 | + public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { |
| 55 | + super.executionFinished(testIdentifier, testExecutionResult); |
| 56 | + if (testIdentifier == null || testExecutionResult == null || !testIdentifier.isTest()) return; |
| 57 | + |
| 58 | + System.out.println(); |
| 59 | + System.out.printf("\t\t--> Finished test \"%s\": %s%n", testIdentifier.getDisplayName(), testExecutionResult); |
| 60 | + System.out.println(); |
| 61 | + } |
| 62 | +} |
0 commit comments