Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Stamann committed Apr 4, 2024
2 parents 2f2cf06 + 6a4bcd1 commit 69d968a
Show file tree
Hide file tree
Showing 25 changed files with 86 additions and 51 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest,macos-latest,windows-latest ]
java: [ 8.0.x, 9.0.x, 10.0.x, 11.0.x, 12.0.x, 13.0.x, 14.0.x, 15.0.x, 16.0.x, 17.0.x, 18.0.x, 19.0.x, 20.0.x, 21.0.x ]
java: [ 8.0.x, 9.0.x, 10.0.x, 11.0.x, 12.0.x, 13.0.x, 14.0.x, 15.0.x, 16.0.x, 17.0.x, 18.0.x, 19.0.x, 20.0.x, 21.0.x, 22.0.x ]

steps:
- uses: actions/checkout@v4
Expand All @@ -23,14 +23,8 @@ jobs:
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Cache .m2
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Prepare mvnw
run: chmod +x ./mvnw

Expand Down
2 changes: 1 addition & 1 deletion coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>cute-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>coverage</name>
Expand Down
2 changes: 1 addition & 1 deletion cute/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>cute-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>cute</name>
Expand Down
38 changes: 26 additions & 12 deletions cute/src/main/java/io/toolisticon/cute/CuteApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
Expand All @@ -54,7 +53,7 @@ public interface CompilerTestBB {
UnitTestType getPassInType();


List<Class<Processor>> processors();
List<Class<? extends Processor>> processors();

List<String> compilerOptions();

Expand Down Expand Up @@ -298,17 +297,10 @@ public interface BlackBoxTestRootInterface {

}

@FluentApiInterface(CompilerTestBB.class)
public interface BlackBoxTestProcessorsInterface {

/**
* Allows you to add a single annotation processor used at black-box tests compilation.
*
* @param processor the annotation processor to use. null values are prohibited and will lead to a {@link io.toolisticon.fluapigen.validation.api.ValidatorException}.
* @return the next fluent interface
*/
BlackBoxTestSourceFilesInterface processor(@FluentApiBackingBeanMapping(value = "processors") @NotNull Class<? extends Processor> processor);

@FluentApiInterface(CompilerTestBB.class)
public interface BlackBoxTestProcessorsInterface{

/**
* Allows you to add annotation processors used at black-box tests compilation.
Expand All @@ -329,7 +321,16 @@ public interface BlackBoxTestProcessorsInterface {
* @param processors the annotation processors to use. Passing an empty collection will compile the source files without using processors, null values are prohibited and will lead to a {@link io.toolisticon.fluapigen.validation.api.ValidatorException}.
* @return the next fluent interface
*/
BlackBoxTestSourceFilesInterface processors(@FluentApiBackingBeanMapping(value = "processors") @NotNull Collection<Class<? extends Processor>> processors);
BlackBoxTestSourceFilesInterface processors(@FluentApiBackingBeanMapping(value = "processors") @NotNull Iterable<Class<? extends Processor>> processors);


/**
* Allows you to add a single annotation processor used at black-box tests compilation.
*
* @param processor the annotation processor to use. null values are prohibited and will lead to a {@link io.toolisticon.fluapigen.validation.api.ValidatorException}.
* @return the next fluent interface
*/
BlackBoxTestSourceFilesAndProcessorInterface processor(@FluentApiBackingBeanMapping(value = "processors") @NotNull Class<? extends Processor> processor);

/**
* More obvious method not to use processors during compilation.
Expand All @@ -343,6 +344,19 @@ default BlackBoxTestSourceFilesInterface noProcessors() {

}

@FluentApiInterface(CompilerTestBB.class)
public interface BlackBoxTestSourceFilesAndProcessorInterface extends BlackBoxTestSourceFilesInterface{

/**
* Allows you to add a single annotation processor used at black-box tests compilation.
*
* @param processor the annotation processor to use. null values are prohibited and will lead to a {@link io.toolisticon.fluapigen.validation.api.ValidatorException}.
* @return the next fluent interface
*/
BlackBoxTestSourceFilesAndProcessorInterface andProcessor(@FluentApiBackingBeanMapping(value = "processors", action = MappingAction.ADD) @NotNull Class<? extends Processor> processor);

}

@FluentApiInterface(CompilerTestBB.class)
public interface BlackBoxTestSourceFilesInterface {

Expand Down
17 changes: 11 additions & 6 deletions cute/src/main/java/io/toolisticon/cute/DebugOutputGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,9 @@ private static String getDebugMessages(CompilationResult compilationResult, Diag


stringBuilder.append("[").append(i)
//.append(diagnostics.getSource() != null ? "|s:'" + ((FileObject)diagnostics.getSource()).getName() + "'" : "")
//.append(diagnostics.getLineNumber() != Diagnostic.NOPOS ? "|l:'" + diagnostics.getLineNumber() + "'" : "")
//.append(diagnostics.getColumnNumber() != Diagnostic.NOPOS ? "|c:'" + diagnostics.getColumnNumber() + "'" : "")
.append("]'")
.append(diagnostics)
.append("'\n");
.append("] : ")
.append(getDiagnosticString(diagnostics))
.append("\n");
i++;
}

Expand All @@ -140,6 +137,14 @@ private static String getDebugMessages(CompilationResult compilationResult, Diag
return stringBuilder.toString();
}

private static String getDiagnosticString(Diagnostic<? extends JavaFileObject> diagnostics) {
return "[ " + diagnostics.getKind() + ", "
+ "s:" + ( diagnostics.getSource() != null ? "'" + diagnostics.getSource().getName() + "'" : "<NOT_RELATED_WITH_SOURCE_FILE>") + ", "
+ "l:" + diagnostics.getLineNumber() + ", "
+ "c:" + diagnostics.getColumnNumber()+ " ] "
+ ":= '" + diagnostics.getMessage(null) + "'";
}

private static String getGeneratedFileOverview(CompilationResult compilationResult) {

return "{\n" +
Expand Down
24 changes: 22 additions & 2 deletions cute/src/test/java/io/toolisticon/cute/CuteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.toolisticon.cute.common.ExceptionThrowerProcessor;
import io.toolisticon.cute.common.SimpleTestProcessor1;
import io.toolisticon.cute.common.SimpleTestProcessor1Interface;
import io.toolisticon.cute.common.SimpleTestProcessor2;
import io.toolisticon.cute.testcases.SimpleTestInterface;
import io.toolisticon.fluapigen.validation.api.ValidatorException;
import org.hamcrest.MatcherAssert;
Expand All @@ -20,6 +21,7 @@
import javax.tools.StandardLocation;
import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -948,7 +950,7 @@ public void blackBoxTest_nullValuedProcessor() {

@Test(expected = ValidatorException.class)
public void blackBoxTest_nullValuedProcessors() {
Cute.blackBoxTest().given().processor(null);
Cute.blackBoxTest().given().processors((Class<Processor>)null);
}

@Test(expected = ValidatorException.class)
Expand Down Expand Up @@ -1168,7 +1170,7 @@ public void blackBoxTest_checkForExpectedException_failure_otherException() {
@Test
public void blackBoxTest_checkForExpectedException_failure_noException() {
try {
Cute.blackBoxTest().given().processor(SimpleTestProcessor1.class)
Cute.blackBoxTest().given().processor(SimpleTestProcessor1.class).andProcessor(SimpleTestProcessor2.class)
.andSourceFiles("/compiletests/exceptionthrown/ExceptionThrownUsecase.java")
.whenCompiled()
.thenExpectThat()
Expand All @@ -1181,4 +1183,22 @@ public void blackBoxTest_checkForExpectedException_failure_noException() {
}
throw new AssertionError("Expected exceptions wasn't triggered!!!");
}

@Test
public void blackBoxTest_AddMultipleProcessorsWithLinkedProcessorApi() throws NoSuchFieldException, IllegalAccessException {

CuteApi.CompilerTestExpectAndThatInterface expectThat = Cute.blackBoxTest().given()
.processor(SimpleTestProcessor1.class)
.andProcessor(SimpleTestProcessor2.class)
.andSourceFiles("/compiletests/generatedclasstest/TestClass.java")
.whenCompiled()
.thenExpectThat()
.compilationSucceeds()
.andThat().generatedClass("io.toolisticon.cute.testhelper.compiletest.TestClassGeneratedClass").exists();


expectThat.executeTest();

}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package io.toolisticon.cute.testhelper.compiletest;

import io.toolisticon.cute.common.SimpleTestAnnotation1;
import io.toolisticon.cute.common.SimpleTestAnnotation2;

@SimpleTestAnnotation1("WORKS!!!")
@SimpleTestAnnotation2
public class TestClass {


Expand Down
2 changes: 1 addition & 1 deletion extension/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>extension-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-api</name>
Expand Down
2 changes: 1 addition & 1 deletion extension/junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>extension-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-junit4</name>
Expand Down
2 changes: 1 addition & 1 deletion extension/junit5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>extension-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-junit5</name>
Expand Down
2 changes: 1 addition & 1 deletion extension/modulesupport/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>extension-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-modulesupport</name>
Expand Down
2 changes: 1 addition & 1 deletion extension/plainjava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>extension-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-plainjava</name>
Expand Down
2 changes: 1 addition & 1 deletion extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>cute-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion extension/testng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>extension-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>extension-testng</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/java9/namedAutomaticModule/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-java9-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-java9-namedAutomaticModule</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/java9/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-java9-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/java9/regularTestModule/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-java9-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-java9-regularModule</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/java9/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-java9-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-java9-test</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/java9/unnamedAutomaticModule/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-java9-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-java9-unnamedAutomaticModule</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-junit4</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/junit5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-junit5</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>cute-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-parent</name>
Expand Down
2 changes: 1 addition & 1 deletion integration-test/testng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>integration-test-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>integration-test-testng</name>
Expand Down
2 changes: 1 addition & 1 deletion legacy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>io.toolisticon.cute</groupId>
<artifactId>cute-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
</parent>

<name>cute-legacy</name>
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.toolisticon.cute</groupId>
<artifactId>cute-parent</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<packaging>pom</packaging>

<name>cute-parent</name>
Expand Down Expand Up @@ -82,11 +82,11 @@
<spiap.version>0.8.0</spiap.version>
<fluapigen.version>1.1.0</fluapigen.version>


<!-- versions of test dependencies -->
<junit4.version>4.13.1</junit4.version>
<junit4.version>4.13.2</junit4.version>
<junit5.version>5.7.2</junit5.version>
<testng.version>6.14.3</testng.version>

<testng.version>7.4.0</testng.version>
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>2.28.2</mockito.version>

Expand Down

0 comments on commit 69d968a

Please sign in to comment.