From b0d9083315426b69d2bf38153987cdeb83460257 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 6 Jan 2023 19:46:12 +0100 Subject: [PATCH] Format integration test projects with Spotless as well --- .../platform-tooling-support-tests.gradle.kts | 16 +++++++++- .../java/com/example/project/Calculator.java | 2 +- .../com/example/project/CalculatorTests.java | 14 ++++----- .../java/com/example/project/Calculator.java | 2 +- .../com/example/project/CalculatorTests.java | 14 ++++----- .../project/ExtensionFunctionsTests.kt | 3 +- .../src/test/java/FooTests.java | 12 ++++---- .../java/com/example/project/Calculator.java | 2 +- .../com/example/project/CalculatorTests.java | 14 ++++----- .../test/java/JUnitPlatformCommonsTests.java | 10 +++++++ .../java/com/example/project/Calculator.java | 2 +- .../com/example/project/CalculatorTests.java | 14 ++++----- .../java/com/example/project/DummyTests.java | 2 +- .../integration/JupiterIntegrationTests.java | 8 ++--- .../integration/ModuleUtilsTests.java | 4 +-- .../src/standalone/JupiterIntegration.java | 2 +- .../standalone/JupiterParamsIntegration.java | 2 +- .../src/standalone/SuiteIntegration.java | 2 +- .../src/standalone/VintageIntegration.java | 2 +- .../java/com/example/vintage/VintageTest.java | 29 ++++++++++++------- 20 files changed, 93 insertions(+), 63 deletions(-) diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 7796f6f7475d..f594af846257 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -2,7 +2,7 @@ import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.jvm.toolchain.internal.NoToolchainAvailableException plugins { - `java-library-conventions` + `kotlin-library-conventions` `testing-conventions` } @@ -10,6 +10,20 @@ javaLibrary { mainJavaVersion = JavaVersion.VERSION_11 } +spotless { + java { + target(files(project.java.sourceSets.map { it.allJava }), "projects/**/*.java") + } + kotlin { + target("projects/**/*.kt") + } + format("projects") { + target("projects/**/*.gradle.kts", "projects/**/*.md") + trimTrailingWhitespace() + endWithNewline() + } +} + val thirdPartyJars by configurations.creating val antJars by configurations.creating val mavenDistribution by configurations.creating diff --git a/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java index 91436757229c..6feca6bfc04b 100644 --- a/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java index b0dfc0524564..695282baccc8 100644 --- a/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -27,15 +27,15 @@ void addsTwoNumbers() { } @ParameterizedTest(name = "{0} + {1} = {2}") - @CsvSource({ - "0, 1, 1", - "1, 2, 3", - "49, 51, 100", - "1, 100, 101" + @CsvSource({ // + "0, 1, 1", // + "1, 2, 3", // + "49, 51, 100", // + "1, 100, 101" // }) void add(int first, int second, int expectedResult) { Calculator calculator = new Calculator(); assertEquals(expectedResult, calculator.add(first, second), - () -> first + " + " + second + " should equal " + expectedResult); + () -> first + " + " + second + " should equal " + expectedResult); } } diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java index b90710f2c68d..6feca6bfc04b 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java index 7f043f0dd3ea..695282baccc8 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -27,15 +27,15 @@ void addsTwoNumbers() { } @ParameterizedTest(name = "{0} + {1} = {2}") - @CsvSource({ - "0, 1, 1", - "1, 2, 3", - "49, 51, 100", - "1, 100, 101" + @CsvSource({ // + "0, 1, 1", // + "1, 2, 3", // + "49, 51, 100", // + "1, 100, 101" // }) void add(int first, int second, int expectedResult) { Calculator calculator = new Calculator(); assertEquals(expectedResult, calculator.add(first, second), - () -> first + " + " + second + " should equal " + expectedResult); + () -> first + " + " + second + " should equal " + expectedResult); } } diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt index b74c92e28f70..0de75b1f9116 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -7,7 +7,6 @@ * * https://www.eclipse.org/legal/epl-v20.html */ - package com.example.project import org.junit.jupiter.api.Assertions.assertEquals diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java b/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java index 79025029964a..86d922c20f4f 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java @@ -1,5 +1,6 @@ + /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -7,7 +8,6 @@ * * https://www.eclipse.org/legal/epl-v20.html */ - import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Assertions; @@ -15,8 +15,8 @@ class FooTests { - @Test - void test() { - fail("This test must not be executed!"); - } + @Test + void test() { + fail("This test must not be executed!"); + } } diff --git a/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java index 91436757229c..6feca6bfc04b 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java index b0dfc0524564..695282baccc8 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -27,15 +27,15 @@ void addsTwoNumbers() { } @ParameterizedTest(name = "{0} + {1} = {2}") - @CsvSource({ - "0, 1, 1", - "1, 2, 3", - "49, 51, 100", - "1, 100, 101" + @CsvSource({ // + "0, 1, 1", // + "1, 2, 3", // + "49, 51, 100", // + "1, 100, 101" // }) void add(int first, int second, int expectedResult) { Calculator calculator = new Calculator(); assertEquals(expectedResult, calculator.add(first, second), - () -> first + " + " + second + " should equal " + expectedResult); + () -> first + " + " + second + " should equal " + expectedResult); } } diff --git a/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java b/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java index 9207c79941fa..53a15919c631 100644 --- a/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java +++ b/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java @@ -1,3 +1,13 @@ + +/* + * Copyright 2015-2023 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java index 91436757229c..6feca6bfc04b 100644 --- a/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java index b0dfc0524564..695282baccc8 100644 --- a/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -27,15 +27,15 @@ void addsTwoNumbers() { } @ParameterizedTest(name = "{0} + {1} = {2}") - @CsvSource({ - "0, 1, 1", - "1, 2, 3", - "49, 51, 100", - "1, 100, 101" + @CsvSource({ // + "0, 1, 1", // + "1, 2, 3", // + "49, 51, 100", // + "1, 100, 101" // }) void add(int first, int second, int expectedResult) { Calculator calculator = new Calculator(); assertEquals(expectedResult, calculator.add(first, second), - () -> first + " + " + second + " should equal " + expectedResult); + () -> first + " + " + second + " should equal " + expectedResult); } } diff --git a/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java b/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java index d9ac6e1d531d..a695ded160b5 100644 --- a/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java +++ b/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java b/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java index 2542b21a8011..311153970b7c 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -42,10 +42,8 @@ void moduleIsNamed() { @Test void resolve() { var selector = DiscoverySelectors.selectClass(getClass()); - var testPlan = LauncherFactory.create().discover(request() - .selectors(selector) - .filters(includeEngines("junit-jupiter")) - .build()); + var testPlan = LauncherFactory.create().discover( + request().selectors(selector).filters(includeEngines("junit-jupiter")).build()); var engine = testPlan.getRoots().iterator().next(); diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/ModuleUtilsTests.java b/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/ModuleUtilsTests.java index a4f0442a40c2..50cecc69625f 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/ModuleUtilsTests.java +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/ModuleUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which @@ -19,9 +19,9 @@ import java.util.Set; import org.junit.jupiter.api.Test; +import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.util.ClassFilter; import org.junit.platform.commons.util.ModuleUtils; -import org.junit.platform.commons.PreconditionViolationException; /** * Unit tests for {@link ModuleUtils}. diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java index fbedffaffe6a..04505d934cca 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java index d94a2f54ddd0..270b9a163a5c 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java index 811ec0f7bc10..a06fc90fbb99 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java index 16bcab6704c6..3fb2886391c6 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2021 the original author or authors. + * Copyright 2015-2023 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java b/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java index bf8e0873de5d..186bbf2eff6a 100644 --- a/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java +++ b/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java @@ -1,18 +1,27 @@ /* - * This Java source file was generated by the Gradle 'init' task. + * Copyright 2015-2023 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html */ + package com.example.vintage; -import org.junit.Test; import static org.junit.Assert.*; +import org.junit.Test; + public class VintageTest { - @Test - public void success() { - // pass - } - @Test - public void failure() { - fail("expected to fail"); - } + @Test + public void success() { + // pass + } + + @Test + public void failure() { + fail("expected to fail"); + } }