Skip to content

Commit

Permalink
Format integration test projects with Spotless as well
Browse files Browse the repository at this point in the history
  • Loading branch information
marcphilipp committed Jan 6, 2023
1 parent c4ed325 commit b0d9083
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,28 @@ import org.gradle.api.tasks.PathSensitivity.RELATIVE
import org.gradle.jvm.toolchain.internal.NoToolchainAvailableException

plugins {
`java-library-conventions`
`kotlin-library-conventions`
`testing-conventions`
}

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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*
* 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
* accompanies this distribution and is available at
*
* https://www.eclipse.org/legal/epl-v20.html
*/

package com.example.project

import org.junit.jupiter.api.Assertions.assertEquals
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

/*
* 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
* accompanies this distribution and is available at
*
* https://www.eclipse.org/legal/epl-v20.html
*/

import static org.junit.jupiter.api.Assertions.fail;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

class FooTests {

@Test
void test() {
fail("This test must not be executed!");
}
@Test
void test() {
fail("This test must not be executed!");
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
}
}

0 comments on commit b0d9083

Please sign in to comment.