-
Notifications
You must be signed in to change notification settings - Fork 10
Add more acceptance tests #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>io.github.ascopes.jct</groupId> | ||
| <artifactId>acceptance-tests</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <relativePath>../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>acceptance-tests-avaje-inject</artifactId> | ||
|
|
||
| <properties> | ||
| <avaje-inject.version>8.10</avaje-inject.version> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>java-compiler-testing</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.avaje</groupId> | ||
| <artifactId>avaje-inject</artifactId> | ||
| <version>${avaje-inject.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>io.avaje</groupId> | ||
| <artifactId>avaje-inject-generator</artifactId> | ||
| <version>${avaje-inject.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.apache.groovy</groupId> | ||
| <artifactId>groovy</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-simple</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.codehaus.gmavenplus</groupId> | ||
| <artifactId>gmavenplus-plugin</artifactId> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
|
|
||
| <configuration> | ||
| <failIfNoTests>true</failIfNoTests> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
59 changes: 59 additions & 0 deletions
59
.../src/test/groovy/io/github/ascopes/jct/acceptancetests/avajeinject/AvajeInjectTest.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright (C) 2022 - 2022 Ashley Scopes | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.github.ascopes.jct.acceptancetests.avajeinject | ||
|
|
||
|
|
||
| import io.github.ascopes.jct.compilers.JctCompiler | ||
| import io.github.ascopes.jct.filemanagers.LoggingMode | ||
| import io.github.ascopes.jct.junit.JavacCompilerTest | ||
| import io.github.ascopes.jct.workspaces.Workspaces | ||
| import org.junit.jupiter.api.DisplayName | ||
|
|
||
| import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation | ||
|
|
||
| @DisplayName("Avaje Inject acceptance tests") | ||
| class AvajeInjectTest { | ||
| @DisplayName("Dependency injection code gets generated as expected") | ||
| @JavacCompilerTest(modules = true) | ||
| void dependencyInjectionCodeGetsGeneratedAsExpected(JctCompiler compiler) { | ||
| // Given | ||
| try (def workspace = Workspaces.newWorkspace()) { | ||
| workspace | ||
| .createSourcePathPackage() | ||
| .rootDirectory() | ||
| .copyContentsFrom("src", "test", "resources", "code") | ||
|
|
||
| // When | ||
| def compilation = compiler | ||
| .diagnosticLoggingMode(LoggingMode.STACKTRACES) | ||
| .compile(workspace) | ||
|
|
||
| // Then | ||
| assertThatCompilation(compilation) | ||
| .isSuccessfulWithoutWarnings() | ||
| .classOutput() | ||
| .packages() | ||
| .allFilesExist( | ||
| 'org/example/CoffeeMaker.class', | ||
| 'org/example/Grinder.class', | ||
| 'org/example/Pump.class', | ||
| 'org/example/CoffeeMaker$DI.class', | ||
| 'org/example/Grinder$DI.class', | ||
| 'org/example/Pump$DI.class', | ||
| ) | ||
| } | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
acceptance-tests/acceptance-tests-avaje-inject/src/test/resources/code/module-info.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright (C) 2022 - 2022 Ashley Scopes | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| module org.example { | ||
| exports org.example; | ||
|
|
||
| requires io.avaje.inject; | ||
|
|
||
| provides io.avaje.inject.spi.Module with org.example.ExampleModule; | ||
| } |
39 changes: 39 additions & 0 deletions
39
...-tests/acceptance-tests-avaje-inject/src/test/resources/code/org/example/CoffeeMaker.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright (C) 2022 - 2022 Ashley Scopes | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.example; | ||
|
|
||
| import jakarta.inject.Inject; | ||
| import jakarta.inject.Singleton; | ||
|
|
||
| /** | ||
| * Makes coffee. | ||
| */ | ||
| @Singleton | ||
| public class CoffeeMaker { | ||
|
|
||
| private final Grinder grinder; | ||
| private final Pump pump; | ||
|
|
||
| @Inject | ||
| public CoffeeMaker(Grinder grinder, Pump pump) { | ||
| this.grinder = grinder; | ||
| this.pump = pump; | ||
| } | ||
|
|
||
| public void makeCoffee() { | ||
| // ... | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
...ance-tests/acceptance-tests-avaje-inject/src/test/resources/code/org/example/Grinder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright (C) 2022 - 2022 Ashley Scopes | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.example; | ||
|
|
||
| import jakarta.inject.Singleton; | ||
|
|
||
| /** | ||
| * Grinds coffee. | ||
| */ | ||
| @Singleton | ||
| public class Grinder { | ||
| // ... | ||
| } |
26 changes: 26 additions & 0 deletions
26
acceptance-tests/acceptance-tests-avaje-inject/src/test/resources/code/org/example/Pump.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright (C) 2022 - 2022 Ashley Scopes | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.example; | ||
|
|
||
| import jakarta.inject.Singleton; | ||
|
|
||
| /** | ||
| * Pumps coffee. | ||
| */ | ||
| @Singleton | ||
| public class Pump { | ||
| // ... | ||
| } |
3 changes: 3 additions & 0 deletions
3
acceptance-tests/acceptance-tests-avaje-inject/src/test/resources/junit-platform.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| junit.jupiter.execution.parallel.enabled=true | ||
| junit.jupiter.execution.parallel.mode.classes.default=SAME_THREAD | ||
| junit.jupiter.execution.parallel.mode.default=CONCURRENT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>io.github.ascopes.jct</groupId> | ||
| <artifactId>acceptance-tests</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <relativePath>../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>acceptance-tests-error-prone</artifactId> | ||
|
|
||
| <properties> | ||
| <argLine> | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED | ||
| --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED | ||
| --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED | ||
| --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED | ||
| </argLine> | ||
|
|
||
| <error-prone.version>2.16</error-prone.version> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>java-compiler-testing</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.google.errorprone</groupId> | ||
| <artifactId>error_prone_core</artifactId> | ||
| <version>${error-prone.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.apache.groovy</groupId> | ||
| <artifactId>groovy</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.junit.jupiter</groupId> | ||
| <artifactId>junit-jupiter</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-simple</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.codehaus.gmavenplus</groupId> | ||
| <artifactId>gmavenplus-plugin</artifactId> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
|
|
||
| <configuration> | ||
| <failIfNoTests>true</failIfNoTests> | ||
| </configuration> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.