@@ -0,0 +1,2807 @@
+/*%0A * Copyright 2015-2016 the original author or authors.%0A *%0A * All rights reserved. This program and the accompanying materials are%0A * made available under the terms of the Eclipse Public License v1.0 which%0A * accompanies this distribution and is available at%0A *%0A * http://www.eclipse.org/legal/epl-v10.html%0A */%0A%0Apackage org.junit.gen5.console.tasks;%0A%0Aimport static java.util.Collections.singleton;%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.junit.gen5.engine.TestExecutionResult.failed;%0Aimport static org.junit.gen5.engine.TestExecutionResult.successful;%0A%0Aimport java.time.Clock;%0Aimport java.util.Optional;%0A%0Aimport org.junit.gen5.api.Test;%0Aimport org.junit.gen5.engine.TestDescriptorStub;%0Aimport org.junit.gen5.engine.TestExecutionResult;%0Aimport org.junit.gen5.engine.support.descriptor.EngineDescriptor;%0Aimport org.junit.gen5.launcher.TestId;%0Aimport org.junit.gen5.launcher.TestPlan;%0A%0Aclass XmlReportDataTests %7B%0A%0A%09@Test%0A%09void resultOfTestIdentifierWithoutAnyReportedEventsIsEmpty() %7B%0A%09%09EngineDescriptor engineDescriptor = new EngineDescriptor(%22engine%22, %22Engine%22);%0A%09%09engineDescriptor.addChild(new TestDescriptorStub(%22test%22));%0A%09%09TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));%0A%0A%09%09XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());%0A%09%09Optional%3CTestExecutionResult%3E result = reportData.getResult(testPlan.getTestIdentifier(new TestId(%22test%22)));%0A%0A%09%09assertThat(result).isEmpty();%0A%09%7D%0A%0A%09@Test%0A%09void resultOfTestIdentifierWithoutReportedEventsIsFailureOfAncestor() %7B%0A%09%09EngineDescriptor engineDescriptor = new EngineDescriptor(%22engine%22, %22Engine%22);%0A%09%09engineDescriptor.addChild(new TestDescriptorStub(%22test%22));%0A%09%09TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));%0A%0A%09%09XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());%0A%09%09TestExecutionResult failureOfAncestor = failed(new RuntimeException(%22failed!%22));%0A%09%09reportData.markFinished(testPlan.getTestIdentifier(new TestId(%22engine%22)), failureOfAncestor);%0A%0A%09%09Optional%3CTestExecutionResult%3E result = reportData.getResult(testPlan.getTestIdentifier(new TestId(%22test%22)));%0A%0A%09%09assertThat(result).contains(failureOfAncestor);%0A%09%7D%0A%0A%09@Test%0A%09void resultOfTestIdentifierWithoutReportedEventsIsEmptyWhenAncestorWasSuccessful() %7B%0A%09%09EngineDescriptor engineDescriptor = new EngineDescriptor(%22engine%22, %22Engine%22);%0A%09%09engineDescriptor.addChild(new TestDescriptorStub(%22test%22));%0A%09%09TestPlan testPlan = TestPlan.from(singleton(engineDescriptor));%0A%0A%09%09XmlReportData reportData = new XmlReportData(testPlan, Clock.systemDefaultZone());%0A%09%09reportData.markFinished(testPlan.getTestIdentifier(new TestId(%22engine%22)), successful());%0A%0A%09%09Optional%3CTestExecutionResult%3E result = reportData.getResult(testPlan.getTestIdentifier(new TestId(%22test%22)));%0A%0A%09%09assertThat(result).isEmpty();%0A%09%7D%0A%7D%0A

Add tests for edge cases of XmlReportData