"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java" between
junit5-r5.3.2.tar.gz and junit5-r5.4.0.tar.gz

About: JUnit 5 is a unit testing framework for the Java programming language.

InvalidLifecycleMethodConfigurationTests.java  (junit5-r5.3.2):InvalidLifecycleMethodConfigurationTests.java  (junit5-r5.4.0)
/* /*
* Copyright 2015-2018 the original author or authors. * Copyright 2015-2019 the original author or authors.
* *
* All rights reserved. This program and the accompanying materials are * All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v2.0 which * made available under the terms of the Eclipse Public License v2.0 which
* accompanies this distribution and is available at * accompanies this distribution and is available at
* *
* http://www.eclipse.org/legal/epl-v20.html * http://www.eclipse.org/legal/epl-v20.html
*/ */
package org.junit.jupiter.engine; package org.junit.jupiter.engine;
import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass ; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass ;
import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.r equest;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.platform.engine.test.event.ExecutionEventRecorder; import org.junit.platform.testkit.engine.EngineExecutionResults;
import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.testkit.engine.Events;
/** /**
* Integration tests that very proper handling of invalid configuration for * Integration tests that very proper handling of invalid configuration for
* lifecycle methods in conjunction with the {@link JupiterTestEngine}. * lifecycle methods in conjunction with the {@link JupiterTestEngine}.
* *
* <p>In general, configuration errors should not be thrown until the * <p>In general, configuration errors should not be thrown until the
* execution phase, thereby giving all containers a chance to execute. * execution phase, thereby giving all containers a chance to execute.
* *
* @since 5.0 * @since 5.0
*/ */
skipping to change at line 58 skipping to change at line 57
void executeValidTestCaseAlongsideTestCaseWithInvalidBeforeEachDeclaratio n() { void executeValidTestCaseAlongsideTestCaseWithInvalidBeforeEachDeclaratio n() {
assertExecutionResults(TestCaseWithInvalidBeforeEachMethod.class) ; assertExecutionResults(TestCaseWithInvalidBeforeEachMethod.class) ;
} }
@Test @Test
void executeValidTestCaseAlongsideTestCaseWithInvalidAfterEachDeclaration () { void executeValidTestCaseAlongsideTestCaseWithInvalidAfterEachDeclaration () {
assertExecutionResults(TestCaseWithInvalidAfterEachMethod.class); assertExecutionResults(TestCaseWithInvalidAfterEachMethod.class);
} }
private void assertExecutionResults(Class<?> invalidTestClass) { private void assertExecutionResults(Class<?> invalidTestClass) {
LauncherDiscoveryRequest request = request().selectors(selectClas EngineExecutionResults executionResults = executeTests(selectClas
s(TestCase.class), s(TestCase.class),
selectClass(invalidTestClass)).build(); selectClass(invalidTestClass));
Events containers = executionResults.containers();
ExecutionEventRecorder eventRecorder = executeTests(request); Events tests = executionResults.tests();
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(3, eventRecorder.getContainerStartedCo () -> assertEquals(3, containers.started().count(), "# co
unt(), "# containers started"), ntainers started"),
() -> assertEquals(1, eventRecorder.getTestStartedCount() () -> assertEquals(1, tests.started().count(), "# tests s
, "# tests started"), tarted"),
() -> assertEquals(1, eventRecorder.getTestSuccessfulCoun () -> assertEquals(1, tests.succeeded().count(), "# tests
t(), "# tests succeeded"), succeeded"),
() -> assertEquals(0, eventRecorder.getTestFailedCount(), () -> assertEquals(0, tests.failed().count(), "# tests fa
"# tests failed"), iled"),
() -> assertEquals(3, eventRecorder.getContainerFinishedC () -> assertEquals(3, containers.finished().count(), "# c
ount(), "# containers finished"), ontainers finished"),
() -> assertEquals(1, eventRecorder.getContainerFailedCou () -> assertEquals(1, containers.failed().count(), "# con
nt(), "# containers failed") tainers failed")
); );
// @formatter:on // @formatter:on
} }
// ---------------------------------------------------------------------- --- // ---------------------------------------------------------------------- ---
static class TestCase { static class TestCase {
@Test @Test
void test() { void test() {
 End of changes. 5 change blocks. 
21 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)