"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "platform-tests/src/test/java/org/junit/platform/console/options/PicocliCommandLineOptionsParserTests.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.

PicocliCommandLineOptionsParserTests.java  (junit5-r5.3.2):PicocliCommandLineOptionsParserTests.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.platform.console.options; package org.junit.platform.console.options;
skipping to change at line 109 skipping to change at line 109
() -> assertEquals(Details.TREE, type.parseArgLine("--det ails tree").getDetails()), () -> assertEquals(Details.TREE, type.parseArgLine("--det ails tree").getDetails()),
() -> assertEquals(Details.FLAT, type.parseArgLine("--det ails flat").getDetails()), () -> assertEquals(Details.FLAT, type.parseArgLine("--det ails flat").getDetails()),
() -> assertEquals(Details.NONE, type.parseArgLine("--det ails NONE").getDetails()), () -> assertEquals(Details.NONE, type.parseArgLine("--det ails NONE").getDetails()),
() -> assertEquals(Details.NONE, type.parseArgLine("--det ails none").getDetails()), () -> assertEquals(Details.NONE, type.parseArgLine("--det ails none").getDetails()),
() -> assertEquals(Details.NONE, type.parseArgLine("--det ails None").getDetails()) () -> assertEquals(Details.NONE, type.parseArgLine("--det ails None").getDetails())
); );
// @formatter:on // @formatter:on
} }
@Test @Test
void parseInvalidDetails() throws Exception { void parseInvalidDetails() {
assertOptionWithMissingRequiredArgumentThrowsException("--details "); assertOptionWithMissingRequiredArgumentThrowsException("--details ");
} }
@ParameterizedTest @ParameterizedTest
@EnumSource(ArgsType.class) @EnumSource(ArgsType.class)
void parseValidDetailsTheme(ArgsType type) { void parseValidDetailsTheme(ArgsType type) {
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(Theme.ASCII, type.parseArgLine("--deta ils-theme ascii").getTheme()), () -> assertEquals(Theme.ASCII, type.parseArgLine("--deta ils-theme ascii").getTheme()),
() -> assertEquals(Theme.ASCII, type.parseArgLine("--deta ils-theme ASCII").getTheme()), () -> assertEquals(Theme.ASCII, type.parseArgLine("--deta ils-theme ASCII").getTheme()),
() -> assertEquals(Theme.UNICODE, type.parseArgLine("--de tails-theme unicode").getTheme()), () -> assertEquals(Theme.UNICODE, type.parseArgLine("--de tails-theme unicode").getTheme()),
() -> assertEquals(Theme.UNICODE, type.parseArgLine("--de tails-theme UNICODE").getTheme()), () -> assertEquals(Theme.UNICODE, type.parseArgLine("--de tails-theme UNICODE").getTheme()),
() -> assertEquals(Theme.UNICODE, type.parseArgLine("--de tails-theme uniCode").getTheme()) () -> assertEquals(Theme.UNICODE, type.parseArgLine("--de tails-theme uniCode").getTheme())
); );
// @formatter:on // @formatter:on
} }
@Test @Test
void parseInvalidDetailsTheme() throws Exception { void parseInvalidDetailsTheme() {
assertOptionWithMissingRequiredArgumentThrowsException("--details -theme"); assertOptionWithMissingRequiredArgumentThrowsException("--details -theme");
} }
@ParameterizedTest @ParameterizedTest
@EnumSource(ArgsType.class) @EnumSource(ArgsType.class)
void parseValidIncludeClassNamePatterns(ArgsType type) { void parseValidIncludeClassNamePatterns(ArgsType type) {
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(singletonList(".*Test"), type.parseArg Line("-n .*Test").getIncludedClassNamePatterns()), () -> assertEquals(singletonList(".*Test"), type.parseArg Line("-n .*Test").getIncludedClassNamePatterns()),
() -> assertEquals(asList(".*Test", ".*Tests"), type.pars eArgLine("--include-classname .*Test --include-classname .*Tests").getIncludedCl assNamePatterns()), () -> assertEquals(asList(".*Test", ".*Tests"), type.pars eArgLine("--include-classname .*Test --include-classname .*Tests").getIncludedCl assNamePatterns()),
skipping to change at line 163 skipping to change at line 163
// @formatter:on // @formatter:on
} }
@Test @Test
void usesDefaultClassNamePatternWithoutExplicitArgument() throws Exceptio n { void usesDefaultClassNamePatternWithoutExplicitArgument() throws Exceptio n {
assertEquals(singletonList(STANDARD_INCLUDE_PATTERN), assertEquals(singletonList(STANDARD_INCLUDE_PATTERN),
ArgsType.args.parseArgLine("").getIncludedClassNamePatter ns()); ArgsType.args.parseArgLine("").getIncludedClassNamePatter ns());
} }
@Test @Test
void parseInvalidIncludeClassNamePatterns() throws Exception { void parseInvalidIncludeClassNamePatterns() {
assertOptionWithMissingRequiredArgumentThrowsException("-n", "--i nclude-classname"); assertOptionWithMissingRequiredArgumentThrowsException("-n", "--i nclude-classname");
} }
@Test @Test
void parseInvalidExcludeClassNamePatterns() throws Exception { void parseInvalidExcludeClassNamePatterns() {
assertOptionWithMissingRequiredArgumentThrowsException("-N", "--e xclude-classname"); assertOptionWithMissingRequiredArgumentThrowsException("-N", "--e xclude-classname");
} }
@ParameterizedTest @ParameterizedTest
@EnumSource(ArgsType.class) @EnumSource(ArgsType.class)
void parseValidIncludedPackages(ArgsType type) { void parseValidIncludedPackages(ArgsType type) {
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(asList("org.junit.included"), () -> assertEquals(asList("org.junit.included"),
type.parseArgLine("--include-pack age org.junit.included").getIncludedPackages()), type.parseArgLine("--include-pack age org.junit.included").getIncludedPackages()),
skipping to change at line 251 skipping to change at line 251
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(asList("junit-jupiter"), type.parseArg Line("-e junit-jupiter").getIncludedEngines()), () -> assertEquals(asList("junit-jupiter"), type.parseArg Line("-e junit-jupiter").getIncludedEngines()),
() -> assertEquals(asList("junit-vintage"), type.parseArg Line("--include-engine junit-vintage").getIncludedEngines()), () -> assertEquals(asList("junit-vintage"), type.parseArg Line("--include-engine junit-vintage").getIncludedEngines()),
() -> assertEquals(emptyList(), type.parseArgLine("").get IncludedEngines()) () -> assertEquals(emptyList(), type.parseArgLine("").get IncludedEngines())
); );
// @formatter:on // @formatter:on
} }
@Test @Test
void parseInvalidIncludedEngines() throws Exception { void parseInvalidIncludedEngines() {
assertOptionWithMissingRequiredArgumentThrowsException("-e", "--i nclude-engine"); assertOptionWithMissingRequiredArgumentThrowsException("-e", "--i nclude-engine");
} }
@ParameterizedTest @ParameterizedTest
@EnumSource(ArgsType.class) @EnumSource(ArgsType.class)
void parseValidExcludedEngines(ArgsType type) { void parseValidExcludedEngines(ArgsType type) {
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(asList("junit-jupiter"), type.parseArg Line("-E junit-jupiter").getExcludedEngines()), () -> assertEquals(asList("junit-jupiter"), type.parseArg Line("-E junit-jupiter").getExcludedEngines()),
() -> assertEquals(asList("junit-vintage"), type.parseArg Line("--exclude-engine junit-vintage").getExcludedEngines()), () -> assertEquals(asList("junit-vintage"), type.parseArg Line("--exclude-engine junit-vintage").getExcludedEngines()),
() -> assertEquals(emptyList(), type.parseArgLine("").get ExcludedEngines()) () -> assertEquals(emptyList(), type.parseArgLine("").get ExcludedEngines())
); );
// @formatter:on // @formatter:on
} }
@Test @Test
void parseInvalidExcludedEngines() throws Exception { void parseInvalidExcludedEngines() {
assertOptionWithMissingRequiredArgumentThrowsException("-E", "--e xclude-engine"); assertOptionWithMissingRequiredArgumentThrowsException("-E", "--e xclude-engine");
} }
@ParameterizedTest @ParameterizedTest
@EnumSource(ArgsType.class) @EnumSource(ArgsType.class)
void parseValidAdditionalClasspathEntries(ArgsType type) { void parseValidAdditionalClasspathEntries(ArgsType type) {
Path dir = Paths.get("."); Path dir = Paths.get(".");
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(singletonList(dir), type.parseArgLine( "-cp .").getAdditionalClasspathEntries()), () -> assertEquals(singletonList(dir), type.parseArgLine( "-cp .").getAdditionalClasspathEntries()),
skipping to change at line 310 skipping to change at line 310
Path dir = Paths.get("build", "test-results"); Path dir = Paths.get("build", "test-results");
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(Optional.of(dir), type.parseArgLine("- -reports-dir build/test-results").getReportsDir()), () -> assertEquals(Optional.of(dir), type.parseArgLine("- -reports-dir build/test-results").getReportsDir()),
() -> assertEquals(Optional.of(dir), type.parseArgLine("- -reports-dir=build/test-results").getReportsDir()) () -> assertEquals(Optional.of(dir), type.parseArgLine("- -reports-dir=build/test-results").getReportsDir())
); );
// @formatter:on // @formatter:on
} }
@Test @Test
void parseInvalidXmlReportsDirs() throws Exception { void parseInvalidXmlReportsDirs() {
assertOptionWithMissingRequiredArgumentThrowsException("--reports -dir"); assertOptionWithMissingRequiredArgumentThrowsException("--reports -dir");
} }
@ParameterizedTest @ParameterizedTest
@EnumSource(ArgsType.class) @EnumSource(ArgsType.class)
void parseValidUriSelectors(ArgsType type) { void parseValidUriSelectors(ArgsType type) {
// @formatter:off // @formatter:off
assertAll( assertAll(
() -> assertEquals(singletonList(new URI("file:// /foo.txt")), type.parseArgLine("-u file:///foo.txt").getSelectedUris()), () -> assertEquals(singletonList(new URI("file:// /foo.txt")), type.parseArgLine("-u file:///foo.txt").getSelectedUris()),
() -> assertEquals(singletonList(new URI("file:// /foo.txt")), type.parseArgLine("--u file:///foo.txt").getSelectedUris()), () -> assertEquals(singletonList(new URI("file:// /foo.txt")), type.parseArgLine("--u file:///foo.txt").getSelectedUris()),
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added

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