Skip to content

Commit

Permalink
Upgrade assertj-gradle.
Browse files Browse the repository at this point in the history
  • Loading branch information
baron1405 committed Jan 31, 2025
1 parent 889d154 commit a8ff884
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }

[libraries]
assertJ = "org.assertj:assertj-core:3.26.3"
assertJGradle = "org.cthing:assertj-gradle:2.0.0"
assertJGradle = "org.cthing:assertj-gradle:3.0.0"
commonsIO = "commons-io:commons-io:2.18.0"
cthingAnnots = "org.cthing:cthing-annotations:2.0.0"
jspecify = "org.jspecify:jspecify:1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,21 @@ public void testApply(@TempDir final File projectDir) {
final Project project = ProjectBuilder.builder().withName("testProject").withProjectDir(projectDir).build();
project.getPluginManager().apply("org.cthing.property-key-constants");

assertThat(project).hasExtensionWithType(PropertyKeyConstantsPlugin.EXTENSION_NAME,
PropertyKeyConstantsExtension.class);
assertThat(project).hasExtensionSatisfying(PropertyKeyConstantsPlugin.EXTENSION_NAME,
PropertyKeyConstantsExtension.class, extension -> {
assertThat(extension.getSourceAccess()).contains(SourceAccess.PUBLIC);
assertThat(extension.getSourceLayout()).contains(SourceLayout.NESTED_CLASSES);
});

assertThat(project).hasTaskSatisfying("generatePropertyKeyConstants", PropertyKeyConstantsTask.class, task -> {
assertThat(task.getClassname()).isEmpty();
assertThat(task.getOutputDirectory()).getString()
.endsWith("build/generated-src/property-key-constants/main");
assertThat(task.getSourceAccess()).contains(SourceAccess.PUBLIC);
assertThat(task.getSourceLayout()).contains(SourceLayout.NESTED_CLASSES);
});

final PropertyKeyConstantsExtension extension =
(PropertyKeyConstantsExtension)project.getExtensions().getByName(PropertyKeyConstantsPlugin.EXTENSION_NAME);
assertThat(extension.getSourceAccess()).contains(SourceAccess.PUBLIC);
assertThat(extension.getSourceLayout()).contains(SourceLayout.NESTED_CLASSES);

assertThat(project).hasTaskWithType("generatePropertyKeyConstants", PropertyKeyConstantsTask.class);
assertThat(project).hasTaskWithType("generateTestPropertyKeyConstants", PropertyKeyConstantsTask.class);

final PropertyKeyConstantsTask task =
(PropertyKeyConstantsTask)project.getTasks().getByName("generatePropertyKeyConstants");
assertThat(task.getClassname()).isEmpty();
assertThat(task.getOutputDirectory()).isPresent();
assertThat(task.getOutputDirectory().get().getAsFile().getPath())
.endsWith("build/generated-src/property-key-constants/main");
assertThat(task.getSourceAccess()).contains(SourceAccess.PUBLIC);
assertThat(task.getSourceLayout()).contains(SourceLayout.NESTED_CLASSES);
}

public static Stream<Arguments> basenameProvider() {
Expand Down

0 comments on commit a8ff884

Please sign in to comment.