diff --git a/README.md b/README.md index 2cd356a..19f1aa6 100644 --- a/README.md +++ b/README.md @@ -81,16 +81,16 @@ public final class Example { var config = new UserConfiguration(); // Save a new instance to the configuration file - Configurations.saveYamlConfiguration(configFile, UserConfiguration.class, config); + YamlConfigurations.saveConfiguration(configFile, UserConfiguration.class, config); // Load a new instance from the configuration file - config = Configurations.loadYamlConfiguration(configFile, UserConfiguration.class); + config = YamlConfigurations.loadConfiguration(configFile, UserConfiguration.class); System.out.println(config.admin.username); System.out.println(config.blockedUsers); // Modify and save the configuration file config.blockedUsers.add(new User("user3", "pass3")); - Configurations.saveYamlConfiguration(configFile, UserConfiguration.class, config); + YamlConfigurations.saveConfiguration(configFile, UserConfiguration.class, config); } } ``` @@ -225,11 +225,14 @@ public final class UnsupportedTypes { There are two ways to load and save configurations. Which way you choose depends on your liking. Both ways have three methods in common: -* `save` saves a configuration to a file -* `load` creates a new configuration instance and populates it with values taken from a file -* `update` is a combination of `load` and `save` and the method you'd usually want to use: it takes - care of creating the configuration file if it does not exist and otherwise updates it to reflect - changes to (the fields or components of) the configuration type. +* The `save` method saves a configuration to a file. The file is created if it does not exist and + is overwritten otherwise. +* The `load` method creates a new configuration instance and populates it with values taken from a + file. For classes, the no-args constructor is used to create a new instance. For records, the + canonical constructor is called. +* The `update` method is a combination of `load` and `save` and the method you'd usually want to + use: it takes care of creating the configuration file if it does not exist and otherwise updates + it to reflect changes to (the fields or components of) the configuration type.
Example of update behavior when configuration file exists @@ -288,14 +291,16 @@ Config config2 = store.update(configurationFile); #### Way 2 -The second way is to use the static methods from the `Configurations` class. +The second way is to use the static methods from the `YamlConfigurations` class. ```java -Config config1 = Configurations.loadYamlConfiguration(configurationFile, Config.class); -Configurations.saveYamlConfiguration(configurationFile, Config.class, config1); -Config config2 = Configurations.updateYamlConfiguration(configurationFile, Config.class); +Config config1 = YamlConfigurations.loadConfiguration(configurationFile, Config.class); +YamlConfigurations.saveConfiguration(configurationFile, Config.class, config1); +Config config2 = YamlConfigurations.updateConfiguration(configurationFile, Config.class); ``` +
+ Each of these methods has two additional overloads: One that takes a properties object and another that lets you configure a properties object builder. For example, the overloads for the `loadYamlConfiguration` method are: @@ -306,16 +311,26 @@ YamlConfigurationProperties properties = YamlConfigurationProperties.newBuilder( .inputNulls(true) .outputNulls(false) .build(); -Config c1 = Configurations.loadYamlConfiguration(configurationFile, Config.class, properties); +Config c1 = YamlConfigurations.loadConfiguration(configurationFile, Config.class, properties); // overload 2 -Config c2 = Configurations.loadYamlConfiguration( +Config c2 = YamlConfigurations.loadConfiguration( configurationFile, Config.class, builder -> builder.inputNulls(true).outputNulls(false) ); ``` +All three methods can also be passed a Java record instead of a class. Because you cannot provide +default values for records, the `update` method also has an additional variant which takes a default +configuration: + +```java +record User(String name, String email) {} +YamlConfigurationStore store = new YamlConfigurationStore<>(User.class, properties); +User user = store.update(configurationFile, new User("John Doe", "john@doe.com")); +``` + ### Configuration properties Instances of the `ConfigurationProperties` class allow customization of how configurations are @@ -339,7 +354,7 @@ YamlConfigurationProperties properties = ConfigLib.BUKKIT_DEFAULT_PROPERTIES.toB .build(); ``` -To get access to this object, you have to import `configlib-paper` instead of `configlib-core` as +To get access to this object, you have to import `configlib-paper` instead of `configlib-yaml` as described in the [Import](#import) section. ### Comments @@ -348,6 +363,11 @@ The fields or components of a configuration can be annotated with the `@Comment` annotation takes an array of strings. Each of these strings is written onto a new line as a comment. Empty strings are written as newlines. +If a configuration type _C_ that defines comments is used (as a field or component) within another +configuration type, the comments of _C_ are written with the proper indentation. However, if +instances of _C_ are stored inside a collection, their comments are not printed when the collection +is written. + Serializing the following configuration as YAML ... ```java @@ -368,10 +388,25 @@ public final class ExampleConfiguration { commentedField: commented field ``` -If a configuration type _C_ that defines comments is used (as a field or component) within another -configuration type, the comments of _C_ are written with the proper indentation. However, if -instances of _C_ are stored inside a collection, their comments are not printed when the collection -is written. +Similarly, if you define the following record configuration and save it ... + +```java +record User(@Comment("The name") String name, @Comment("The address") Address address) {} +record Address(@Comment("The street") String street) {} + +User user = new User("John Doe", new Address("10 Downing St")); +``` + +... you get: + +```yaml +# The name +name: John Doe +# The address +address: + # The street + street: 10 Downing St +``` ### Subclassing @@ -498,13 +533,13 @@ instances of `B` (or some other subclass of `A`) in it. #### Custom serializers -If you want to add support for a type is not a record or whose class is not annotated +If you want to add support for a type that is not a record or whose class is not annotated with `@Configuration`, you can register a custom serializer. Serializers are instances of the `de.exlll.configlib.Serializer` interface. When implementing that interface you have to make sure that you convert your source type into one of the valid target types listed in the table above. The serializer then has to be registered through a `ConfigurationProperties` object. -The following `Serializer` serializes instances of `java.awt.Point` into strings. +The following `Serializer` serializes instances of `java.awt.Point` into strings and vice versa. ```java public final class PointSerializer implements Serializer { @@ -565,6 +600,25 @@ public final class RecursiveTypDefinitions {
+## Project structure + +This project contains three classes of modules: + +* The `configlib-core` module contains most of the logic of this library. In it, you can find (among + other things), the object mapper that converts configuration instances to maps (and vice versa), + most serializers, and the classes responsible for the extraction of comments. It does not + contain anything Minecraft related. +* The `configlib-yaml` module contains the classes that can save configuration instances as YAML + files and instantiate new instances from such files. This module does not contain anything + Minecraft related, either. +* The `configlib-paper`, `configlib-velocity`, and `configlib-waterfall` modules contain basic + plugins that are used to conveniently load this library. These three modules shade the `-core` + module, the `-yaml` module, and the YAML parser when the `shadowJar` task is executed. The shaded + jar files are released on the [releases page](https://github.com/Exlll/ConfigLib/releases). + * The `configlib-paper` module additionally contains the `ConfigLib.BUKKIT_DEFAULT_PROPERTIES` + object which adds support for the serialization of Bukkit classes like `ItemStack` as + described [here](#support-for-bukkit-classes-like-itemstack). + ## Import **INFO:** I'm currently looking for an easier way for you to import this library that does not @@ -572,8 +626,8 @@ require authentication with GitHub. Please check this [issue](https://github.com/Exlll/ConfigLib/issues/12) if you have authentication problems. To use this library, import it into your project with either Maven or Gradle as shown in the two -sections below. This library has additional dependencies (namely, a YAML parser) which are not -included in the artifact you import. +examples below. This library has additional dependencies (namely, a YAML parser) which are not +exposed by the artifact you import. This repository provides plugin versions of this library which bundle all its dependencies, so you don't have to worry about them. Also, these versions make it easier for you to update this library @@ -581,16 +635,16 @@ if you have written multiple plugins that use it. The plugin versions can be downloaded from the [releases page](https://github.com/Exlll/ConfigLib/releases) where you can identify them by -their `-paper-`, `-waterfall-`, and `-velocity-` infix and `-all` suffix. Other than that, the -plugin versions currently don't add any additional functionality. If you use these versions, don't -forget to add them as a dependency in the `plugin.yml` (for Paper and Waterfall) or to the -dependencies array (for Velocity) of your own plugin. +their `-paper-`, `-waterfall-`, and `-velocity-` infix and `-all` suffix. Except for the `-paper-` +version, the other two plugin versions currently don't add any additional functionality. If you use +these versions, don't forget to add them as a dependency in the `plugin.yml` (for Paper and +Waterfall) or to the dependencies array (for Velocity) of your own plugin. -Alternatively, if you don't want to use an extra plugin, you can shade the `-core` version and the +Alternatively, if you don't want to use an extra plugin, you can shade the `-yaml` version with its YAML parser yourself. **NOTE:** If you want serialization support for Bukkit classes like `ItemStack`, -replace `configlib-core` with `configlib-paper` +replace `configlib-yaml` with `configlib-paper` (see [here](#support-for-bukkit-classes-like-itemstack)). #### Maven @@ -603,7 +657,7 @@ replace `configlib-core` with `configlib-paper` de.exlll - configlib-core + configlib-yaml 3.1.0 ``` @@ -613,13 +667,13 @@ replace `configlib-core` with `configlib-paper` ```groovy repositories { maven { url 'https://maven.pkg.github.com/Exlll/ConfigLib' } } -dependencies { implementation 'de.exlll:configlib-core:3.1.0' } +dependencies { implementation 'de.exlll:configlib-yaml:3.1.0' } ``` ```kotlin repositories { maven { url = uri("https://maven.pkg.github.com/Exlll/ConfigLib") } } -dependencies { implementation("de.exlll:configlib-core:3.1.0") } +dependencies { implementation("de.exlll:configlib-yaml:3.1.0") } ``` ## Future work diff --git a/buildSrc/src/main/kotlin/core-config.gradle.kts b/buildSrc/src/main/kotlin/core-config.gradle.kts new file mode 100644 index 0000000..eb05b34 --- /dev/null +++ b/buildSrc/src/main/kotlin/core-config.gradle.kts @@ -0,0 +1,72 @@ +plugins { + `java-library` + `java-test-fixtures` + `maven-publish` + idea +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + + withJavadocJar() + withSourcesJar() +} + +tasks.getByName("test") { + useJUnitPlatform() +} + +repositories { + mavenCentral() + maven(url = "https://papermc.io/repo/repository/maven-public/") +} + +dependencies { + testFixturesApi("org.junit.jupiter:junit-jupiter-api:5.8.2") + testFixturesApi("org.junit.jupiter:junit-jupiter-params:5.8.2") + testFixturesApi("org.junit.jupiter:junit-jupiter-engine:5.8.2") + testFixturesApi("org.junit.platform:junit-platform-runner:1.8.2") + testFixturesApi("org.junit.platform:junit-platform-suite-api:1.8.2") + testFixturesApi("org.mockito:mockito-inline:4.2.0") + testFixturesApi("org.mockito:mockito-junit-jupiter:4.2.0") + testFixturesApi("org.hamcrest:hamcrest-all:1.3") + testFixturesApi("com.google.jimfs:jimfs:1.2") +} + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/Exlll/ConfigLib") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + + val moduleId = project.name.split("-")[1].toLowerCase() + val publicationName = moduleId.capitalize() + + publications { + register(publicationName) { + from(components["java"]) + } + } +} + +idea { + module { + isDownloadJavadoc = true + isDownloadSources = true + } +} + +val javaComponent = components["java"] as AdhocComponentWithVariants +javaComponent.withVariantsFromConfiguration(configurations["testFixturesApiElements"]) { + skip() +} +javaComponent.withVariantsFromConfiguration(configurations["testFixturesRuntimeElements"]) { + skip() +} diff --git a/buildSrc/src/main/kotlin/java-config.gradle.kts b/buildSrc/src/main/kotlin/java-config.gradle.kts deleted file mode 100644 index c27fee3..0000000 --- a/buildSrc/src/main/kotlin/java-config.gradle.kts +++ /dev/null @@ -1,91 +0,0 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - -plugins { - java - idea - `maven-publish` - id("com.github.johnrengelman.shadow") -} - -val shade = configurations.create("shade") - -configurations { - compileClasspath.get().extendsFrom(shade) -} - -val shadowJarTask = tasks.getByName("shadowJar") { - configurations = listOf(shade) - relocate("org.snakeyaml.engine", "de.exlll.configlib.org.snakeyaml.engine") -} - -val coreProjectCheckTask = project(":configlib-core").tasks.getByName("check"); - -shadowJarTask.dependsOn( - tasks.named("check"), - coreProjectCheckTask -) - -tasks.getByName("build").dependsOn(coreProjectCheckTask) - -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - - withJavadocJar() - withSourcesJar() -} - -tasks.getByName("test") { - useJUnitPlatform() -} - -repositories { - mavenCentral() - maven(url = "https://papermc.io/repo/repository/maven-public/") -} - -dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") - testImplementation("org.junit.jupiter:junit-jupiter-params:5.8.2") - testImplementation("org.junit.jupiter:junit-jupiter-engine:5.8.2") - testImplementation("org.junit.platform:junit-platform-runner:1.8.2") - testImplementation("org.junit.platform:junit-platform-suite-api:1.8.2") - testImplementation("org.mockito:mockito-inline:4.2.0") - testImplementation("org.mockito:mockito-junit-jupiter:4.2.0") - testImplementation("org.hamcrest:hamcrest-all:1.3") - testImplementation("com.google.jimfs:jimfs:1.2") -} - -val javaComponent = components["java"] as AdhocComponentWithVariants -javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { - skip() -} - -publishing { - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/Exlll/ConfigLib") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } - - val moduleId = project.name.split("-")[1].toLowerCase() - val publicationName = moduleId.capitalize() - - publications { - register(publicationName) { - from(components["java"]) - } - } -} - -idea { - module { - isDownloadJavadoc = true - isDownloadSources = true - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/libs-config.gradle.kts b/buildSrc/src/main/kotlin/libs-config.gradle.kts new file mode 100644 index 0000000..b77efb5 --- /dev/null +++ b/buildSrc/src/main/kotlin/libs-config.gradle.kts @@ -0,0 +1,12 @@ +plugins { + `java-library` +} + +dependencies { + api(project(":configlib-core")) + testImplementation(testFixtures(project(":configlib-core"))) +} + +tasks.compileJava { + dependsOn(project(":configlib-core").tasks.check) +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/plugins-config.gradle.kts b/buildSrc/src/main/kotlin/plugins-config.gradle.kts new file mode 100644 index 0000000..0016df1 --- /dev/null +++ b/buildSrc/src/main/kotlin/plugins-config.gradle.kts @@ -0,0 +1,28 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +plugins { + `java-library` + id("com.github.johnrengelman.shadow") +} + +dependencies { + api(project(":configlib-yaml")) +} + +tasks.shadowJar { + relocate("org.snakeyaml.engine", "de.exlll.configlib.org.snakeyaml.engine") +} + +tasks.compileJava { + dependsOn( + project(":configlib-core").tasks.check, + project(":configlib-yaml").tasks.check + ) +} + +val javaComponent = components["java"] as AdhocComponentWithVariants +val shadowRuntimeElementsConfiguration = configurations["shadowRuntimeElements"] + +javaComponent.withVariantsFromConfiguration(shadowRuntimeElementsConfiguration) { + skip() +} \ No newline at end of file diff --git a/configlib-core/build.gradle.kts b/configlib-core/build.gradle.kts index 9e59321..71ff8c2 100644 --- a/configlib-core/build.gradle.kts +++ b/configlib-core/build.gradle.kts @@ -1,8 +1,7 @@ plugins { - `java-config` + `core-config` } dependencies { - shade("org.snakeyaml:snakeyaml-engine:2.3") implementation("org.snakeyaml:snakeyaml-engine:2.3") } \ No newline at end of file diff --git a/configlib-core/src/test/java/de/exlll/configlib/ExampleConfigurationTests.java b/configlib-core/src/test/java/de/exlll/configlib/ExampleConfigurationTests.java index 932dbe3..bdc2813 100644 --- a/configlib-core/src/test/java/de/exlll/configlib/ExampleConfigurationTests.java +++ b/configlib-core/src/test/java/de/exlll/configlib/ExampleConfigurationTests.java @@ -11,14 +11,10 @@ import java.io.IOException; import java.nio.file.FileSystem; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import java.util.Map; import static de.exlll.configlib.configurations.ExampleConfigurationsSerialized.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static de.exlll.configlib.configurations.ExampleEqualityAsserter.*; import static org.junit.jupiter.api.Assertions.assertEquals; class ExampleConfigurationTests { @@ -258,535 +254,4 @@ class ExampleConfigurationTests { ExampleRecord2 deserialize2 = serializer.deserialize(EXAMPLE_RECORD2_2); assertExampleRecord2Equal(ExampleInitializer.EXAMPLE_RECORD2_2, deserialize2); } - - private static void assertExampleRecord1Equal( - ExampleRecord1 expected, - ExampleRecord1 actual - ) { - assertThat(actual.i(), is(expected.i())); - assertThat(actual.d(), is(expected.d())); - assertThat(actual.enm(), is(expected.enm())); - assertThat(actual.listUuid(), is(expected.listUuid())); - assertThat(actual.arrayArrayFloat(), is(expected.arrayArrayFloat())); - assertExampleConfigurationsB1Equal(expected.b1(), actual.b1()); - } - - private static void assertExampleRecord2Equal( - ExampleRecord2 expected, - ExampleRecord2 actual - ) { - assertEquals(expected.b(), actual.b()); - assertExampleRecord1Equal(expected.r1(), actual.r1()); - } - - private static void assertExampleConfigurationsNullsEqual( - ExampleConfigurationNulls expected, - ExampleConfigurationNulls actual - ) { - assertEquals(expected.getNullInteger(), actual.getNullInteger()); - assertEquals(expected.getNullString(), actual.getNullString()); - assertEquals(expected.getNullEnm(), actual.getNullEnm()); - assertEquals(expected.getNullB1(), actual.getNullB1()); - assertEquals(expected.getNullList(), actual.getNullList()); - assertEquals(expected.getNullArray(), actual.getNullArray()); - assertEquals(expected.getNullSet(), actual.getNullSet()); - assertEquals(expected.getNullMap(), actual.getNullMap()); - assertEquals(expected.getNullPoint(), actual.getNullPoint()); - assertEquals(expected.getListNullString(), actual.getListNullString()); - assertArrayEquals(expected.getArrayNullDouble(), actual.getArrayNullDouble()); - assertEquals(expected.getSetNullInteger(), actual.getSetNullInteger()); - assertEquals(expected.getMapNullEnmKey(), actual.getMapNullEnmKey()); - assertEquals(expected.getMapNullBigIntegerValue(), actual.getMapNullBigIntegerValue()); - assertEquals(expected, actual); - } - - private static void assertExampleConfigurationsA1Equal( - ExampleConfigurationA1 a1_1, - ExampleConfigurationA1 a1_2 - ) { - assertThat(ExampleConfigurationA1.getA1_staticFinalInt(), is(1)); - assertThat(ExampleConfigurationA1.getA1_staticInt(), is(2)); - - assertThat(a1_1.getA1_finalInt(), is(a1_2.getA1_finalInt())); - assertThat(a1_1.getA1_transientInt(), is(a1_2.getA1_transientInt())); - assertThat(a1_1.getA1_ignoredInt(), is(a1_2.getA1_ignoredInt())); - assertThat(a1_1.getA1_ignoredString(), is(a1_2.getA1_ignoredString())); - assertThat(a1_1.getA1_ignoredListString(), is(a1_2.getA1_ignoredListString())); - assertThat(a1_1.isA1_primBool(), is(a1_2.isA1_primBool())); - assertThat(a1_1.getA1_primChar(), is(a1_2.getA1_primChar())); - assertThat(a1_1.getA1_primByte(), is(a1_2.getA1_primByte())); - assertThat(a1_1.getA1_primShort(), is(a1_2.getA1_primShort())); - assertThat(a1_1.getA1_primInt(), is(a1_2.getA1_primInt())); - assertThat(a1_1.getA1_primLong(), is(a1_2.getA1_primLong())); - assertThat(a1_1.getA1_primFloat(), is(a1_2.getA1_primFloat())); - assertThat(a1_1.getA1_primDouble(), is(a1_2.getA1_primDouble())); - assertThat(a1_1.getA1_refBool(), is(a1_2.getA1_refBool())); - assertThat(a1_1.getA1_refChar(), is(a1_2.getA1_refChar())); - assertThat(a1_1.getA1_refByte(), is(a1_2.getA1_refByte())); - assertThat(a1_1.getA1_refShort(), is(a1_2.getA1_refShort())); - assertThat(a1_1.getA1_refInt(), is(a1_2.getA1_refInt())); - assertThat(a1_1.getA1_refLong(), is(a1_2.getA1_refLong())); - assertThat(a1_1.getA1_refFloat(), is(a1_2.getA1_refFloat())); - assertThat(a1_1.getA1_refDouble(), is(a1_2.getA1_refDouble())); - assertThat(a1_1.getA1_string(), is(a1_2.getA1_string())); - assertThat(a1_1.getA1_bigInteger(), is(a1_2.getA1_bigInteger())); - assertThat(a1_1.getA1_bigDecimal(), is(a1_2.getA1_bigDecimal())); - assertThat(a1_1.getA1_localDate(), is(a1_2.getA1_localDate())); - assertThat(a1_1.getA1_localTime(), is(a1_2.getA1_localTime())); - assertThat(a1_1.getA1_localDateTime(), is(a1_2.getA1_localDateTime())); - assertThat(a1_1.getA1_instant(), is(a1_2.getA1_instant())); - assertThat(a1_1.getA1_uuid(), is(a1_2.getA1_uuid())); - assertThat(a1_1.getA1_file(), is(a1_2.getA1_file())); - assertThat(a1_1.getA1_path(), is(a1_2.getA1_path())); - assertThat(a1_1.getA1_url(), is(a1_2.getA1_url())); - assertThat(a1_1.getA1_uri(), is(a1_2.getA1_uri())); - assertThat(a1_1.getA1_uuid(), is(a1_2.getA1_uuid())); - assertThat(a1_1.getA1_Enm(), is(a1_2.getA1_Enm())); - assertThat(a1_1.getA1_b1(), is(a1_2.getA1_b1())); - assertThat(a1_1.getA1_b2(), is(a1_2.getA1_b2())); - assertThat(a1_1.getA1_r1(), is(a1_2.getA1_r1())); - assertThat(a1_1.getA1_r2(), is(a1_2.getA1_r2())); - assertThat(a1_1.getA1_listBoolean(), is(a1_2.getA1_listBoolean())); - assertThat(a1_1.getA1_listChar(), is(a1_2.getA1_listChar())); - assertThat(a1_1.getA1_listByte(), is(a1_2.getA1_listByte())); - assertThat(a1_1.getA1_listShort(), is(a1_2.getA1_listShort())); - assertThat(a1_1.getA1_listInteger(), is(a1_2.getA1_listInteger())); - assertThat(a1_1.getA1_listLong(), is(a1_2.getA1_listLong())); - assertThat(a1_1.getA1_listFloat(), is(a1_2.getA1_listFloat())); - assertThat(a1_1.getA1_listDouble(), is(a1_2.getA1_listDouble())); - assertThat(a1_1.getA1_listString(), is(a1_2.getA1_listString())); - assertThat(a1_1.getA1_listBigInteger(), is(a1_2.getA1_listBigInteger())); - assertThat(a1_1.getA1_listBigDecimal(), is(a1_2.getA1_listBigDecimal())); - assertThat(a1_1.getA1_listLocalDate(), is(a1_2.getA1_listLocalDate())); - assertThat(a1_1.getA1_listLocalTime(), is(a1_2.getA1_listLocalTime())); - assertThat(a1_1.getA1_listLocalDateTime(), is(a1_2.getA1_listLocalDateTime())); - assertThat(a1_1.getA1_listInstant(), is(a1_2.getA1_listInstant())); - assertThat(a1_1.getA1_listUuid(), is(a1_2.getA1_listUuid())); - assertThat(a1_1.getA1_listFile(), is(a1_2.getA1_listFile())); - assertThat(a1_1.getA1_listPath(), is(a1_2.getA1_listPath())); - assertThat(a1_1.getA1_listUrl(), is(a1_2.getA1_listUrl())); - assertThat(a1_1.getA1_listUri(), is(a1_2.getA1_listUri())); - assertThat(a1_1.getA1_listEnm(), is(a1_2.getA1_listEnm())); - assertThat(a1_1.getA1_listB1(), is(a1_2.getA1_listB1())); - assertThat(a1_1.getA1_listB2(), is(a1_2.getA1_listB2())); - assertThat(a1_1.getA1_listR1(), is(a1_2.getA1_listR1())); - assertThat(a1_1.getA1_listR2(), is(a1_2.getA1_listR2())); - assertThat(a1_1.getA1_arrayPrimBoolean(), is(a1_2.getA1_arrayPrimBoolean())); - assertThat(a1_1.getA1_arrayPrimChar(), is(a1_2.getA1_arrayPrimChar())); - assertThat(a1_1.getA1_arrayPrimByte(), is(a1_2.getA1_arrayPrimByte())); - assertThat(a1_1.getA1_arrayPrimShort(), is(a1_2.getA1_arrayPrimShort())); - assertThat(a1_1.getA1_arrayPrimInteger(), is(a1_2.getA1_arrayPrimInteger())); - assertThat(a1_1.getA1_arrayPrimLong(), is(a1_2.getA1_arrayPrimLong())); - assertThat(a1_1.getA1_arrayPrimFloat(), is(a1_2.getA1_arrayPrimFloat())); - assertThat(a1_1.getA1_arrayPrimDouble(), is(a1_2.getA1_arrayPrimDouble())); - assertThat(a1_1.getA1_arrayBoolean(), is(a1_2.getA1_arrayBoolean())); - assertThat(a1_1.getA1_arrayChar(), is(a1_2.getA1_arrayChar())); - assertThat(a1_1.getA1_arrayByte(), is(a1_2.getA1_arrayByte())); - assertThat(a1_1.getA1_arrayShort(), is(a1_2.getA1_arrayShort())); - assertThat(a1_1.getA1_arrayInteger(), is(a1_2.getA1_arrayInteger())); - assertThat(a1_1.getA1_arrayLong(), is(a1_2.getA1_arrayLong())); - assertThat(a1_1.getA1_arrayFloat(), is(a1_2.getA1_arrayFloat())); - assertThat(a1_1.getA1_arrayDouble(), is(a1_2.getA1_arrayDouble())); - assertThat(a1_1.getA1_arrayString(), is(a1_2.getA1_arrayString())); - assertThat(a1_1.getA1_arrayBigInteger(), is(a1_2.getA1_arrayBigInteger())); - assertThat(a1_1.getA1_arrayBigDecimal(), is(a1_2.getA1_arrayBigDecimal())); - assertThat(a1_1.getA1_arrayLocalDate(), is(a1_2.getA1_arrayLocalDate())); - assertThat(a1_1.getA1_arrayLocalTime(), is(a1_2.getA1_arrayLocalTime())); - assertThat(a1_1.getA1_arrayLocalDateTime(), is(a1_2.getA1_arrayLocalDateTime())); - assertThat(a1_1.getA1_arrayUuid(), is(a1_2.getA1_arrayUuid())); - assertThat(a1_1.getA1_arrayEnm(), is(a1_2.getA1_arrayEnm())); - assertThat(a1_1.getA1_arrayB1(), is(a1_2.getA1_arrayB1())); - assertThat(a1_1.getA1_arrayB2(), is(a1_2.getA1_arrayB2())); - assertThat(a1_1.getA1_arrayR1(), is(a1_2.getA1_arrayR1())); - assertThat(a1_1.getA1_arrayR2(), is(a1_2.getA1_arrayR2())); - assertThat(a1_1.getA1_setBoolean(), is(a1_2.getA1_setBoolean())); - assertThat(a1_1.getA1_setChar(), is(a1_2.getA1_setChar())); - assertThat(a1_1.getA1_setByte(), is(a1_2.getA1_setByte())); - assertThat(a1_1.getA1_setShort(), is(a1_2.getA1_setShort())); - assertThat(a1_1.getA1_setInteger(), is(a1_2.getA1_setInteger())); - assertThat(a1_1.getA1_setLong(), is(a1_2.getA1_setLong())); - assertThat(a1_1.getA1_setFloat(), is(a1_2.getA1_setFloat())); - assertThat(a1_1.getA1_setDouble(), is(a1_2.getA1_setDouble())); - assertThat(a1_1.getA1_setString(), is(a1_2.getA1_setString())); - assertThat(a1_1.getA1_setBigInteger(), is(a1_2.getA1_setBigInteger())); - assertThat(a1_1.getA1_setBigDecimal(), is(a1_2.getA1_setBigDecimal())); - assertThat(a1_1.getA1_setLocalDate(), is(a1_2.getA1_setLocalDate())); - assertThat(a1_1.getA1_setLocalTime(), is(a1_2.getA1_setLocalTime())); - assertThat(a1_1.getA1_setLocalDateTime(), is(a1_2.getA1_setLocalDateTime())); - assertThat(a1_1.getA1_setUuid(), is(a1_2.getA1_setUuid())); - assertThat(a1_1.getA1_setEnm(), is(a1_2.getA1_setEnm())); - assertThat(a1_1.getA1_setB1(), is(a1_2.getA1_setB1())); - assertThat(a1_1.getA1_setB2(), is(a1_2.getA1_setB2())); - assertThat(a1_1.getA1_setR1(), is(a1_2.getA1_setR1())); - assertThat(a1_1.getA1_setR2(), is(a1_2.getA1_setR2())); - assertThat(a1_1.getA1_mapBooleanBoolean(), is(a1_2.getA1_mapBooleanBoolean())); - assertThat(a1_1.getA1_mapCharChar(), is(a1_2.getA1_mapCharChar())); - assertThat(a1_1.getA1_mapByteByte(), is(a1_2.getA1_mapByteByte())); - assertThat(a1_1.getA1_mapShortShort(), is(a1_2.getA1_mapShortShort())); - assertThat(a1_1.getA1_mapIntegerInteger(), is(a1_2.getA1_mapIntegerInteger())); - assertThat(a1_1.getA1_mapLongLong(), is(a1_2.getA1_mapLongLong())); - assertThat(a1_1.getA1_mapFloatFloat(), is(a1_2.getA1_mapFloatFloat())); - assertThat(a1_1.getA1_mapDoubleDouble(), is(a1_2.getA1_mapDoubleDouble())); - assertThat(a1_1.getA1_mapStringString(), is(a1_2.getA1_mapStringString())); - assertThat(a1_1.getA1_mapBigIntegerBigInteger(), is(a1_2.getA1_mapBigIntegerBigInteger())); - assertThat(a1_1.getA1_mapBigDecimalBigDecimal(), is(a1_2.getA1_mapBigDecimalBigDecimal())); - assertThat(a1_1.getA1_mapLocalDateLocalDate(), is(a1_2.getA1_mapLocalDateLocalDate())); - assertThat(a1_1.getA1_mapLocalTimeLocalTime(), is(a1_2.getA1_mapLocalTimeLocalTime())); - assertThat(a1_1.getA1_mapLocalDateTimeLocalDateTime(), is(a1_2.getA1_mapLocalDateTimeLocalDateTime())); - assertThat(a1_1.getA1_mapUuidUuid(), is(a1_2.getA1_mapUuidUuid())); - assertThat(a1_1.getA1_mapEnmEnm(), is(a1_2.getA1_mapEnmEnm())); - assertThat(a1_1.getA1_mapIntegerB1(), is(a1_2.getA1_mapIntegerB1())); - assertThat(a1_1.getA1_mapEnmB2(), is(a1_2.getA1_mapEnmB2())); - assertThat(a1_1.getA1_mapStringR1(), is(a1_2.getA1_mapStringR1())); - assertThat(a1_1.getA1_mapStringR2(), is(a1_2.getA1_mapStringR2())); - assertThat(a1_1.getA1_listEmpty(), is(a1_2.getA1_listEmpty())); - assertThat(a1_1.getA1_arrayEmpty(), is(a1_2.getA1_arrayEmpty())); - assertThat(a1_1.getA1_setEmpty(), is(a1_2.getA1_setEmpty())); - assertThat(a1_1.getA1_mapEmpty(), is(a1_2.getA1_mapEmpty())); - assertThat(a1_1.getA1_listListByte(), is(a1_2.getA1_listListByte())); - assertDeepEquals(a1_1.getA1_listArrayFloat(), a1_2.getA1_listArrayFloat(), ArrayList::new); - assertThat(a1_1.getA1_listSetString(), is(a1_2.getA1_listSetString())); - assertThat(a1_1.getA1_listMapEnmLocalDate(), is(a1_2.getA1_listMapEnmLocalDate())); - assertThat(a1_1.getA1_setSetShort(), is(a1_2.getA1_setSetShort())); - assertDeepEquals(a1_1.getA1_setArrayDouble(), a1_2.getA1_setArrayDouble(), HashSet::new); - assertThat(a1_1.getA1_setListString(), is(a1_2.getA1_setListString())); - assertThat(a1_1.getA1_setMapEnmLocalTime(), is(a1_2.getA1_setMapEnmLocalTime())); - assertThat(a1_1.getA1_mapIntegerMapLongBoolean(), is(a1_2.getA1_mapIntegerMapLongBoolean())); - assertThat(a1_1.getA1_mapStringListB1(), is(a1_2.getA1_mapStringListB1())); - assertEquals(a1_2.getA1_mapBigIntegerArrayBigDecimal().keySet(), a1_1.getA1_mapBigIntegerArrayBigDecimal().keySet()); - assertDeepEquals(a1_2.getA1_mapBigIntegerArrayBigDecimal().values(), a1_2.getA1_mapBigIntegerArrayBigDecimal().values(), HashSet::new); - assertThat(a1_1.getA1_mapEnmSetB2(), is(a1_2.getA1_mapEnmSetB2())); - assertThat(a1_1.getA1_mapIntegerListMapShortSetB2(), is(a1_2.getA1_mapIntegerListMapShortSetB2())); - assertThat(a1_1.getA1_arrayArrayPrimBoolean(), is(a1_2.getA1_arrayArrayPrimBoolean())); - assertThat(a1_1.getA1_arrayArrayPrimChar(), is(a1_2.getA1_arrayArrayPrimChar())); - assertThat(a1_1.getA1_arrayArrayPrimByte(), is(a1_2.getA1_arrayArrayPrimByte())); - assertThat(a1_1.getA1_arrayArrayPrimShort(), is(a1_2.getA1_arrayArrayPrimShort())); - assertThat(a1_1.getA1_arrayArrayPrimInteger(), is(a1_2.getA1_arrayArrayPrimInteger())); - assertThat(a1_1.getA1_arrayArrayPrimLong(), is(a1_2.getA1_arrayArrayPrimLong())); - assertThat(a1_1.getA1_arrayArrayPrimFloat(), is(a1_2.getA1_arrayArrayPrimFloat())); - assertThat(a1_1.getA1_arrayArrayPrimDouble(), is(a1_2.getA1_arrayArrayPrimDouble())); - assertThat(a1_1.getA1_arrayArrayBoolean(), is(a1_2.getA1_arrayArrayBoolean())); - assertThat(a1_1.getA1_arrayArrayChar(), is(a1_2.getA1_arrayArrayChar())); - assertThat(a1_1.getA1_arrayArrayByte(), is(a1_2.getA1_arrayArrayByte())); - assertThat(a1_1.getA1_arrayArrayShort(), is(a1_2.getA1_arrayArrayShort())); - assertThat(a1_1.getA1_arrayArrayInteger(), is(a1_2.getA1_arrayArrayInteger())); - assertThat(a1_1.getA1_arrayArrayLong(), is(a1_2.getA1_arrayArrayLong())); - assertThat(a1_1.getA1_arrayArrayFloat(), is(a1_2.getA1_arrayArrayFloat())); - assertThat(a1_1.getA1_arrayArrayDouble(), is(a1_2.getA1_arrayArrayDouble())); - assertThat(a1_1.getA1_arrayArrayString(), is(a1_2.getA1_arrayArrayString())); - assertThat(a1_1.getA1_arrayArrayBigInteger(), is(a1_2.getA1_arrayArrayBigInteger())); - assertThat(a1_1.getA1_arrayArrayBigDecimal(), is(a1_2.getA1_arrayArrayBigDecimal())); - assertThat(a1_1.getA1_arrayArrayLocalDate(), is(a1_2.getA1_arrayArrayLocalDate())); - assertThat(a1_1.getA1_arrayArrayLocalTime(), is(a1_2.getA1_arrayArrayLocalTime())); - assertThat(a1_1.getA1_arrayArrayLocalDateTime(), is(a1_2.getA1_arrayArrayLocalDateTime())); - assertThat(a1_1.getA1_arrayArrayUuid(), is(a1_2.getA1_arrayArrayUuid())); - assertThat(a1_1.getA1_arrayArrayEnm(), is(a1_2.getA1_arrayArrayEnm())); - assertThat(a1_1.getA1_arrayArrayB1(), is(a1_2.getA1_arrayArrayB1())); - assertThat(a1_1.getA1_arrayArrayB2(), is(a1_2.getA1_arrayArrayB2())); - assertThat(a1_1.getA1_arrayArrayR1(), is(a1_2.getA1_arrayArrayR1())); - assertThat(a1_1.getA1_arrayArrayR2(), is(a1_2.getA1_arrayArrayR2())); - assertThat(a1_1.getA1_point(), is(a1_2.getA1_point())); - assertThat(a1_1.getA1_listPoint(), is(a1_2.getA1_listPoint())); - assertThat(a1_1.getA1_arrayPoint(), is(a1_2.getA1_arrayPoint())); - assertThat(a1_1.getA1_setPoint(), is(a1_2.getA1_setPoint())); - assertThat(a1_1.getA1_mapEnmListPoint(), is(a1_2.getA1_mapEnmListPoint())); - } - - static void assertExampleConfigurationsA2Equal( - ExampleConfigurationA2 a2_1, - ExampleConfigurationA2 a2_2 - ) { - assertThat(ExampleConfigurationA2.getA1_staticFinalInt(), is(1)); - assertThat(ExampleConfigurationA2.getA1_staticInt(), is(2)); - - assertExampleConfigurationsA1Equal(a2_1, a2_2); - - assertThat(a2_1.getA2_finalInt(), is(a2_2.getA2_finalInt())); - assertThat(a2_1.getA2_transientInt(), is(a2_2.getA2_transientInt())); - assertThat(a2_1.getA2_ignoredInt(), is(a2_2.getA2_ignoredInt())); - assertThat(a2_1.getA2_ignoredString(), is(a2_2.getA2_ignoredString())); - assertThat(a2_1.getA2_ignoredListString(), is(a2_2.getA2_ignoredListString())); - assertThat(a2_1.isA2_primBool(), is(a2_2.isA2_primBool())); - assertThat(a2_1.getA2_primChar(), is(a2_2.getA2_primChar())); - assertThat(a2_1.getA2_primByte(), is(a2_2.getA2_primByte())); - assertThat(a2_1.getA2_primShort(), is(a2_2.getA2_primShort())); - assertThat(a2_1.getA2_primInt(), is(a2_2.getA2_primInt())); - assertThat(a2_1.getA2_primLong(), is(a2_2.getA2_primLong())); - assertThat(a2_1.getA2_primFloat(), is(a2_2.getA2_primFloat())); - assertThat(a2_1.getA2_primDouble(), is(a2_2.getA2_primDouble())); - assertThat(a2_1.getA2_refBool(), is(a2_2.getA2_refBool())); - assertThat(a2_1.getA2_refChar(), is(a2_2.getA2_refChar())); - assertThat(a2_1.getA2_refByte(), is(a2_2.getA2_refByte())); - assertThat(a2_1.getA2_refShort(), is(a2_2.getA2_refShort())); - assertThat(a2_1.getA2_refInt(), is(a2_2.getA2_refInt())); - assertThat(a2_1.getA2_refLong(), is(a2_2.getA2_refLong())); - assertThat(a2_1.getA2_refFloat(), is(a2_2.getA2_refFloat())); - assertThat(a2_1.getA2_refDouble(), is(a2_2.getA2_refDouble())); - assertThat(a2_1.getA2_string(), is(a2_2.getA2_string())); - assertThat(a2_1.getA2_bigInteger(), is(a2_2.getA2_bigInteger())); - assertThat(a2_1.getA2_bigDecimal(), is(a2_2.getA2_bigDecimal())); - assertThat(a2_1.getA2_localDate(), is(a2_2.getA2_localDate())); - assertThat(a2_1.getA2_localTime(), is(a2_2.getA2_localTime())); - assertThat(a2_1.getA2_localDateTime(), is(a2_2.getA2_localDateTime())); - assertThat(a2_1.getA2_instant(), is(a2_2.getA2_instant())); - assertThat(a2_1.getA2_uuid(), is(a2_2.getA2_uuid())); - assertThat(a2_1.getA2_file(), is(a2_2.getA2_file())); - assertThat(a2_1.getA2_path(), is(a2_2.getA2_path())); - assertThat(a2_1.getA2_url(), is(a2_2.getA2_url())); - assertThat(a2_1.getA2_uri(), is(a2_2.getA2_uri())); - assertThat(a2_1.getA2_Enm(), is(a2_2.getA2_Enm())); - assertThat(a2_1.getA2_b1(), is(a2_2.getA2_b1())); - assertThat(a2_1.getA2_b2(), is(a2_2.getA2_b2())); - assertThat(a2_1.getA2_r1(), is(a2_2.getA2_r1())); - assertThat(a2_1.getA2_r2(), is(a2_2.getA2_r2())); - assertThat(a2_1.getA2_listBoolean(), is(a2_2.getA2_listBoolean())); - assertThat(a2_1.getA2_listChar(), is(a2_2.getA2_listChar())); - assertThat(a2_1.getA2_listByte(), is(a2_2.getA2_listByte())); - assertThat(a2_1.getA2_listShort(), is(a2_2.getA2_listShort())); - assertThat(a2_1.getA2_listInteger(), is(a2_2.getA2_listInteger())); - assertThat(a2_1.getA2_listLong(), is(a2_2.getA2_listLong())); - assertThat(a2_1.getA2_listFloat(), is(a2_2.getA2_listFloat())); - assertThat(a2_1.getA2_listDouble(), is(a2_2.getA2_listDouble())); - assertThat(a2_1.getA2_listString(), is(a2_2.getA2_listString())); - assertThat(a2_1.getA2_listBigInteger(), is(a2_2.getA2_listBigInteger())); - assertThat(a2_1.getA2_listBigDecimal(), is(a2_2.getA2_listBigDecimal())); - assertThat(a2_1.getA2_listLocalDate(), is(a2_2.getA2_listLocalDate())); - assertThat(a2_1.getA2_listLocalTime(), is(a2_2.getA2_listLocalTime())); - assertThat(a2_1.getA2_listLocalDateTime(), is(a2_2.getA2_listLocalDateTime())); - assertThat(a2_1.getA2_listInstant(), is(a2_2.getA2_listInstant())); - assertThat(a2_1.getA2_listUuid(), is(a2_2.getA2_listUuid())); - assertThat(a2_1.getA2_listFile(), is(a2_2.getA2_listFile())); - assertThat(a2_1.getA2_listPath(), is(a2_2.getA2_listPath())); - assertThat(a2_1.getA2_listUrl(), is(a2_2.getA2_listUrl())); - assertThat(a2_1.getA2_listUri(), is(a2_2.getA2_listUri())); - assertThat(a2_1.getA2_listEnm(), is(a2_2.getA2_listEnm())); - assertThat(a2_1.getA2_listB1(), is(a2_2.getA2_listB1())); - assertThat(a2_1.getA2_listB2(), is(a2_2.getA2_listB2())); - assertThat(a2_1.getA2_listR1(), is(a2_2.getA2_listR1())); - assertThat(a2_1.getA2_listR2(), is(a2_2.getA2_listR2())); - assertThat(a2_1.getA2_arrayPrimBoolean(), is(a2_2.getA2_arrayPrimBoolean())); - assertThat(a2_1.getA2_arrayPrimChar(), is(a2_2.getA2_arrayPrimChar())); - assertThat(a2_1.getA2_arrayPrimByte(), is(a2_2.getA2_arrayPrimByte())); - assertThat(a2_1.getA2_arrayPrimShort(), is(a2_2.getA2_arrayPrimShort())); - assertThat(a2_1.getA2_arrayPrimInteger(), is(a2_2.getA2_arrayPrimInteger())); - assertThat(a2_1.getA2_arrayPrimLong(), is(a2_2.getA2_arrayPrimLong())); - assertThat(a2_1.getA2_arrayPrimFloat(), is(a2_2.getA2_arrayPrimFloat())); - assertThat(a2_1.getA2_arrayPrimDouble(), is(a2_2.getA2_arrayPrimDouble())); - assertThat(a2_1.getA2_arrayBoolean(), is(a2_2.getA2_arrayBoolean())); - assertThat(a2_1.getA2_arrayChar(), is(a2_2.getA2_arrayChar())); - assertThat(a2_1.getA2_arrayByte(), is(a2_2.getA2_arrayByte())); - assertThat(a2_1.getA2_arrayShort(), is(a2_2.getA2_arrayShort())); - assertThat(a2_1.getA2_arrayInteger(), is(a2_2.getA2_arrayInteger())); - assertThat(a2_1.getA2_arrayLong(), is(a2_2.getA2_arrayLong())); - assertThat(a2_1.getA2_arrayFloat(), is(a2_2.getA2_arrayFloat())); - assertThat(a2_1.getA2_arrayDouble(), is(a2_2.getA2_arrayDouble())); - assertThat(a2_1.getA2_arrayString(), is(a2_2.getA2_arrayString())); - assertThat(a2_1.getA2_arrayBigInteger(), is(a2_2.getA2_arrayBigInteger())); - assertThat(a2_1.getA2_arrayBigDecimal(), is(a2_2.getA2_arrayBigDecimal())); - assertThat(a2_1.getA2_arrayLocalDate(), is(a2_2.getA2_arrayLocalDate())); - assertThat(a2_1.getA2_arrayLocalTime(), is(a2_2.getA2_arrayLocalTime())); - assertThat(a2_1.getA2_arrayLocalDateTime(), is(a2_2.getA2_arrayLocalDateTime())); - assertThat(a2_1.getA2_arrayUuid(), is(a2_2.getA2_arrayUuid())); - assertThat(a2_1.getA2_arrayEnm(), is(a2_2.getA2_arrayEnm())); - assertThat(a2_1.getA2_arrayB1(), is(a2_2.getA2_arrayB1())); - assertThat(a2_1.getA2_arrayB2(), is(a2_2.getA2_arrayB2())); - assertThat(a2_1.getA2_arrayR1(), is(a2_2.getA2_arrayR1())); - assertThat(a2_1.getA2_arrayR2(), is(a2_2.getA2_arrayR2())); - assertThat(a2_1.getA2_setBoolean(), is(a2_2.getA2_setBoolean())); - assertThat(a2_1.getA2_setChar(), is(a2_2.getA2_setChar())); - assertThat(a2_1.getA2_setByte(), is(a2_2.getA2_setByte())); - assertThat(a2_1.getA2_setShort(), is(a2_2.getA2_setShort())); - assertThat(a2_1.getA2_setInteger(), is(a2_2.getA2_setInteger())); - assertThat(a2_1.getA2_setLong(), is(a2_2.getA2_setLong())); - assertThat(a2_1.getA2_setFloat(), is(a2_2.getA2_setFloat())); - assertThat(a2_1.getA2_setDouble(), is(a2_2.getA2_setDouble())); - assertThat(a2_1.getA2_setString(), is(a2_2.getA2_setString())); - assertThat(a2_1.getA2_setBigInteger(), is(a2_2.getA2_setBigInteger())); - assertThat(a2_1.getA2_setBigDecimal(), is(a2_2.getA2_setBigDecimal())); - assertThat(a2_1.getA2_setLocalDate(), is(a2_2.getA2_setLocalDate())); - assertThat(a2_1.getA2_setLocalTime(), is(a2_2.getA2_setLocalTime())); - assertThat(a2_1.getA2_setLocalDateTime(), is(a2_2.getA2_setLocalDateTime())); - assertThat(a2_1.getA2_setUuid(), is(a2_2.getA2_setUuid())); - assertThat(a2_1.getA2_setEnm(), is(a2_2.getA2_setEnm())); - assertThat(a2_1.getA2_setB1(), is(a2_2.getA2_setB1())); - assertThat(a2_1.getA2_setB2(), is(a2_2.getA2_setB2())); - assertThat(a2_1.getA2_setR1(), is(a2_2.getA2_setR1())); - assertThat(a2_1.getA2_setR2(), is(a2_2.getA2_setR2())); - assertThat(a2_1.getA2_mapBooleanBoolean(), is(a2_2.getA2_mapBooleanBoolean())); - assertThat(a2_1.getA2_mapCharChar(), is(a2_2.getA2_mapCharChar())); - assertThat(a2_1.getA2_mapByteByte(), is(a2_2.getA2_mapByteByte())); - assertThat(a2_1.getA2_mapShortShort(), is(a2_2.getA2_mapShortShort())); - assertThat(a2_1.getA2_mapIntegerInteger(), is(a2_2.getA2_mapIntegerInteger())); - assertThat(a2_1.getA2_mapLongLong(), is(a2_2.getA2_mapLongLong())); - assertThat(a2_1.getA2_mapFloatFloat(), is(a2_2.getA2_mapFloatFloat())); - assertThat(a2_1.getA2_mapDoubleDouble(), is(a2_2.getA2_mapDoubleDouble())); - assertThat(a2_1.getA2_mapStringString(), is(a2_2.getA2_mapStringString())); - assertThat(a2_1.getA2_mapBigIntegerBigInteger(), is(a2_2.getA2_mapBigIntegerBigInteger())); - assertThat(a2_1.getA2_mapBigDecimalBigDecimal(), is(a2_2.getA2_mapBigDecimalBigDecimal())); - assertThat(a2_1.getA2_mapLocalDateLocalDate(), is(a2_2.getA2_mapLocalDateLocalDate())); - assertThat(a2_1.getA2_mapLocalTimeLocalTime(), is(a2_2.getA2_mapLocalTimeLocalTime())); - assertThat(a2_1.getA2_mapLocalDateTimeLocalDateTime(), is(a2_2.getA2_mapLocalDateTimeLocalDateTime())); - assertThat(a2_1.getA2_mapUuidUuid(), is(a2_2.getA2_mapUuidUuid())); - assertThat(a2_1.getA2_mapEnmEnm(), is(a2_2.getA2_mapEnmEnm())); - assertThat(a2_1.getA2_mapIntegerB1(), is(a2_2.getA2_mapIntegerB1())); - assertThat(a2_1.getA2_mapEnmB2(), is(a2_2.getA2_mapEnmB2())); - assertThat(a2_1.getA2_mapStringR1(), is(a2_2.getA2_mapStringR1())); - assertThat(a2_1.getA2_mapStringR2(), is(a2_2.getA2_mapStringR2())); - assertThat(a2_1.getA2_listEmpty(), is(a2_2.getA2_listEmpty())); - assertThat(a2_1.getA2_arrayEmpty(), is(a2_2.getA2_arrayEmpty())); - assertThat(a2_1.getA2_setEmpty(), is(a2_2.getA2_setEmpty())); - assertThat(a2_1.getA2_mapEmpty(), is(a2_2.getA2_mapEmpty())); - assertThat(a2_1.getA2_listListByte(), is(a2_2.getA2_listListByte())); - assertDeepEquals(a2_1.getA2_listArrayFloat(), a2_2.getA2_listArrayFloat(), ArrayList::new); - assertThat(a2_1.getA2_listSetString(), is(a2_2.getA2_listSetString())); - assertThat(a2_1.getA2_listMapEnmLocalDate(), is(a2_2.getA2_listMapEnmLocalDate())); - assertThat(a2_1.getA2_setSetShort(), is(a2_2.getA2_setSetShort())); - assertDeepEquals(a2_1.getA2_setArrayDouble(), a2_2.getA2_setArrayDouble(), HashSet::new); - assertThat(a2_1.getA2_setListString(), is(a2_2.getA2_setListString())); - assertThat(a2_1.getA2_setMapEnmLocalTime(), is(a2_2.getA2_setMapEnmLocalTime())); - assertThat(a2_1.getA2_mapIntegerMapLongBoolean(), is(a2_2.getA2_mapIntegerMapLongBoolean())); - assertThat(a2_1.getA2_mapStringListB1(), is(a2_2.getA2_mapStringListB1())); - assertEquals(a2_2.getA2_mapBigIntegerArrayBigDecimal().keySet(), a2_1.getA2_mapBigIntegerArrayBigDecimal().keySet()); - assertDeepEquals(a2_2.getA2_mapBigIntegerArrayBigDecimal().values(), a2_2.getA2_mapBigIntegerArrayBigDecimal().values(), HashSet::new); - assertThat(a2_1.getA2_mapEnmSetB2(), is(a2_2.getA2_mapEnmSetB2())); - assertThat(a2_1.getA2_mapIntegerListMapShortSetB2(), is(a2_2.getA2_mapIntegerListMapShortSetB2())); - assertThat(a2_1.getA2_arrayArrayPrimBoolean(), is(a2_2.getA2_arrayArrayPrimBoolean())); - assertThat(a2_1.getA2_arrayArrayPrimChar(), is(a2_2.getA2_arrayArrayPrimChar())); - assertThat(a2_1.getA2_arrayArrayPrimByte(), is(a2_2.getA2_arrayArrayPrimByte())); - assertThat(a2_1.getA2_arrayArrayPrimShort(), is(a2_2.getA2_arrayArrayPrimShort())); - assertThat(a2_1.getA2_arrayArrayPrimInteger(), is(a2_2.getA2_arrayArrayPrimInteger())); - assertThat(a2_1.getA2_arrayArrayPrimLong(), is(a2_2.getA2_arrayArrayPrimLong())); - assertThat(a2_1.getA2_arrayArrayPrimFloat(), is(a2_2.getA2_arrayArrayPrimFloat())); - assertThat(a2_1.getA2_arrayArrayPrimDouble(), is(a2_2.getA2_arrayArrayPrimDouble())); - assertThat(a2_1.getA2_arrayArrayBoolean(), is(a2_2.getA2_arrayArrayBoolean())); - assertThat(a2_1.getA2_arrayArrayChar(), is(a2_2.getA2_arrayArrayChar())); - assertThat(a2_1.getA2_arrayArrayByte(), is(a2_2.getA2_arrayArrayByte())); - assertThat(a2_1.getA2_arrayArrayShort(), is(a2_2.getA2_arrayArrayShort())); - assertThat(a2_1.getA2_arrayArrayInteger(), is(a2_2.getA2_arrayArrayInteger())); - assertThat(a2_1.getA2_arrayArrayLong(), is(a2_2.getA2_arrayArrayLong())); - assertThat(a2_1.getA2_arrayArrayFloat(), is(a2_2.getA2_arrayArrayFloat())); - assertThat(a2_1.getA2_arrayArrayDouble(), is(a2_2.getA2_arrayArrayDouble())); - assertThat(a2_1.getA2_arrayArrayString(), is(a2_2.getA2_arrayArrayString())); - assertThat(a2_1.getA2_arrayArrayBigInteger(), is(a2_2.getA2_arrayArrayBigInteger())); - assertThat(a2_1.getA2_arrayArrayBigDecimal(), is(a2_2.getA2_arrayArrayBigDecimal())); - assertThat(a2_1.getA2_arrayArrayLocalDate(), is(a2_2.getA2_arrayArrayLocalDate())); - assertThat(a2_1.getA2_arrayArrayLocalTime(), is(a2_2.getA2_arrayArrayLocalTime())); - assertThat(a2_1.getA2_arrayArrayLocalDateTime(), is(a2_2.getA2_arrayArrayLocalDateTime())); - assertThat(a2_1.getA2_arrayArrayUuid(), is(a2_2.getA2_arrayArrayUuid())); - assertThat(a2_1.getA2_arrayArrayEnm(), is(a2_2.getA2_arrayArrayEnm())); - assertThat(a2_1.getA2_arrayArrayB1(), is(a2_2.getA2_arrayArrayB1())); - assertThat(a2_1.getA2_arrayArrayB2(), is(a2_2.getA2_arrayArrayB2())); - assertThat(a2_1.getA2_arrayArrayR1(), is(a2_2.getA2_arrayArrayR1())); - assertThat(a2_1.getA2_arrayArrayR2(), is(a2_2.getA2_arrayArrayR2())); - assertThat(a2_1.getA2_point(), is(a2_2.getA2_point())); - assertThat(a2_1.getA2_listPoint(), is(a2_2.getA2_listPoint())); - assertThat(a2_1.getA2_arrayPoint(), is(a2_2.getA2_arrayPoint())); - assertThat(a2_1.getA2_setPoint(), is(a2_2.getA2_setPoint())); - assertThat(a2_1.getA2_mapEnmListPoint(), is(a2_2.getA2_mapEnmListPoint())); - } - - - private static void assertExampleConfigurationsB1Equal( - ExampleConfigurationB1 b1_1, - ExampleConfigurationB1 b1_2 - ) { - assertThat(ExampleConfigurationB1.getB1_staticFinalInt(), is(1)); - assertThat(ExampleConfigurationB1.getB1_staticInt(), is(2)); - - assertThat(b1_1.getB1_finalInt(), is(b1_2.getB1_finalInt())); - assertThat(b1_1.getB1_transientInt(), is(b1_2.getB1_transientInt())); - assertThat(b1_1.getB1_ignoredInt(), is(b1_2.getB1_ignoredInt())); - assertThat(b1_1.getB1_ignoredString(), is(b1_2.getB1_ignoredString())); - assertThat(b1_1.getB1_ignoredListString(), is(b1_2.getB1_ignoredListString())); - assertThat(b1_1.isB1_primBool(), is(b1_2.isB1_primBool())); - assertThat(b1_1.getB1_refChar(), is(b1_2.getB1_refChar())); - assertThat(b1_1.getB1_string(), is(b1_2.getB1_string())); - assertThat(b1_1.getB1_listByte(), is(b1_2.getB1_listByte())); - assertThat(b1_1.getB1_arrayShort(), is(b1_2.getB1_arrayShort())); - assertThat(b1_1.getB1_setInteger(), is(b1_2.getB1_setInteger())); - assertThat(b1_1.getB1_listEmpty(), is(b1_2.getB1_listEmpty())); - assertThat(b1_1.getB1_mapLongLong(), is(b1_2.getB1_mapLongLong())); - assertThat(b1_1.getB1_listListByte(), is(b1_2.getB1_listListByte())); - assertThat(b1_1.getB1_point(), is(b1_2.getB1_point())); - assertEquals(b1_2, b1_1); - } - - private static void assertExampleConfigurationsB2Equal( - ExampleConfigurationB2 b2_1, - ExampleConfigurationB2 b2_2 - ) { - assertExampleConfigurationsB1Equal(b2_1, b2_2); - - assertThat(ExampleConfigurationB2.getB1_staticFinalInt(), is(1)); - assertThat(ExampleConfigurationB2.getB1_staticInt(), is(2)); - - assertThat(b2_1.getB2_finalInt(), is(b2_2.getB2_finalInt())); - assertThat(b2_1.getB2_transientInt(), is(b2_2.getB2_transientInt())); - assertThat(b2_1.getB2_ignoredInt(), is(b2_2.getB2_ignoredInt())); - assertThat(b2_1.getB2_ignoredString(), is(b2_2.getB2_ignoredString())); - assertThat(b2_1.getB2_ignoredListString(), is(b2_2.getB2_ignoredListString())); - assertThat(b2_1.getB2_primChar(), is(b2_2.getB2_primChar())); - assertThat(b2_1.getB2_refBool(), is(b2_2.getB2_refBool())); - assertThat(b2_1.getB2_bigInteger(), is(b2_2.getB2_bigInteger())); - assertThat(b2_1.getB2_listShort(), is(b2_2.getB2_listShort())); - assertThat(b2_1.getB2_arrayInteger(), is(b2_2.getB2_arrayInteger())); - assertThat(b2_1.getB2_setLong(), is(b2_2.getB2_setLong())); - assertThat(b2_1.getB2_arrayEmpty(), is(b2_2.getB2_arrayEmpty())); - assertThat(b2_1.getB2_mapFloatFloat(), is(b2_2.getB2_mapFloatFloat())); - assertDeepEquals(b2_1.getB2_setArrayDouble(), b2_2.getB2_setArrayDouble(), LinkedHashSet::new); - assertThat(b2_1.getB2_listPoint(), is(b2_2.getB2_listPoint())); - assertEquals(b2_2, b2_1); - } - - private static > void assertDeepEquals( - C collection1, - C collection2, - Supplier>> collectionFactory - ) { - Collection> c1 = collection1.stream().map(Arrays::asList) - .collect(Collectors.toCollection(collectionFactory)); - Collection> c2 = collection2.stream().map(Arrays::asList) - .collect(Collectors.toCollection(collectionFactory)); - assertEquals(c2, c1); - } - - @Test - void yamlStoreSavesAndLoadsExampleConfigurationA2() { - var properties = YamlConfigurationProperties.newBuilder() - .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) - .build(); - var store = new YamlConfigurationStore<>(ExampleConfigurationA2.class, properties); - ExampleConfigurationA2 cfg1 = ExampleInitializer.newExampleConfigurationA2(); - store.save(cfg1, yamlFile); - ExampleConfigurationA2 cfg2 = store.load(yamlFile); - assertExampleConfigurationsA2Equal(cfg1, cfg2); - } - - @Test - void yamlStoreSavesAndLoadsExampleConfigurationNullsWithNullCollectionElements1() { - var properties = YamlConfigurationProperties.newBuilder() - .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) - .outputNulls(true) - .inputNulls(true) - .build(); - var store = new YamlConfigurationStore<>(ExampleConfigurationNulls.class, properties); - ExampleConfigurationNulls cfg1 = ExampleInitializer - .newExampleConfigurationNullsWithNullCollectionElements1(); - store.save(cfg1, yamlFile); - ExampleConfigurationNulls cfg2 = store.load(yamlFile); - assertExampleConfigurationsNullsEqual(cfg1, cfg2); - } - - @Test - void yamlStoreSavesAndLoadsExampleConfigurationNullsWithoutNullCollectionElements1() { - var properties = YamlConfigurationProperties.newBuilder() - .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) - .build(); - var store = new YamlConfigurationStore<>(ExampleConfigurationNulls.class, properties); - ExampleConfigurationNulls cfg1 = ExampleInitializer - .newExampleConfigurationNullsWithoutNullCollectionElements1(); - store.save(cfg1, yamlFile); - ExampleConfigurationNulls cfg2 = store.load(yamlFile); - assertExampleConfigurationsNullsEqual(cfg1, cfg2); - } } diff --git a/configlib-core/src/test/java/de/exlll/configlib/TestUtils.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/TestUtils.java similarity index 96% rename from configlib-core/src/test/java/de/exlll/configlib/TestUtils.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/TestUtils.java index d180978..abad0c2 100644 --- a/configlib-core/src/test/java/de/exlll/configlib/TestUtils.java +++ b/configlib-core/src/testFixtures/java/de/exlll/configlib/TestUtils.java @@ -1,5 +1,6 @@ package de.exlll.configlib; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.function.Executable; import java.awt.Point; @@ -14,8 +15,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import static java.util.stream.Collectors.joining; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; public final class TestUtils { public static final PointSerializer POINT_SERIALIZER = new PointSerializer(); @@ -62,8 +61,8 @@ public final class TestUtils { Executable executable, String expectedExceptionMessage ) { - T exception = assertThrows(exceptionType, executable); - assertEquals(expectedExceptionMessage, exception.getMessage()); + T exception = Assertions.assertThrows(exceptionType, executable); + Assertions.assertEquals(expectedExceptionMessage, exception.getMessage()); } public static final class CustomBigIntegerSerializer implements Serializer { diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationA1.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationA1.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationA1.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationA1.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationA2.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationA2.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationA2.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationA2.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationB1.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationB1.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationB1.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationB1.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationB2.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationB2.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationB2.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationB2.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationNulls.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationNulls.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationNulls.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationNulls.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationsSerialized.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationsSerialized.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleConfigurationsSerialized.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleConfigurationsSerialized.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleEnum.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleEnum.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleEnum.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleEnum.java diff --git a/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleEqualityAsserter.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleEqualityAsserter.java new file mode 100644 index 0000000..470cf8e --- /dev/null +++ b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleEqualityAsserter.java @@ -0,0 +1,503 @@ +package de.exlll.configlib.configurations; + +import java.util.*; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public final class ExampleEqualityAsserter { + public static void assertExampleRecord1Equal( + ExampleRecord1 expected, + ExampleRecord1 actual + ) { + assertThat(actual.i(), is(expected.i())); + assertThat(actual.d(), is(expected.d())); + assertThat(actual.enm(), is(expected.enm())); + assertThat(actual.listUuid(), is(expected.listUuid())); + assertThat(actual.arrayArrayFloat(), is(expected.arrayArrayFloat())); + assertExampleConfigurationsB1Equal(expected.b1(), actual.b1()); + } + + public static void assertExampleRecord2Equal( + ExampleRecord2 expected, + ExampleRecord2 actual + ) { + assertEquals(expected.b(), actual.b()); + assertExampleRecord1Equal(expected.r1(), actual.r1()); + } + + public static void assertExampleConfigurationsNullsEqual( + ExampleConfigurationNulls expected, + ExampleConfigurationNulls actual + ) { + assertEquals(expected.getNullInteger(), actual.getNullInteger()); + assertEquals(expected.getNullString(), actual.getNullString()); + assertEquals(expected.getNullEnm(), actual.getNullEnm()); + assertEquals(expected.getNullB1(), actual.getNullB1()); + assertEquals(expected.getNullList(), actual.getNullList()); + assertEquals(expected.getNullArray(), actual.getNullArray()); + assertEquals(expected.getNullSet(), actual.getNullSet()); + assertEquals(expected.getNullMap(), actual.getNullMap()); + assertEquals(expected.getNullPoint(), actual.getNullPoint()); + assertEquals(expected.getListNullString(), actual.getListNullString()); + assertArrayEquals(expected.getArrayNullDouble(), actual.getArrayNullDouble()); + assertEquals(expected.getSetNullInteger(), actual.getSetNullInteger()); + assertEquals(expected.getMapNullEnmKey(), actual.getMapNullEnmKey()); + assertEquals(expected.getMapNullBigIntegerValue(), actual.getMapNullBigIntegerValue()); + assertEquals(expected, actual); + } + + public static void assertExampleConfigurationsA1Equal( + ExampleConfigurationA1 a1_1, + ExampleConfigurationA1 a1_2 + ) { + assertThat(ExampleConfigurationA1.getA1_staticFinalInt(), is(1)); + assertThat(ExampleConfigurationA1.getA1_staticInt(), is(2)); + + assertThat(a1_1.getA1_finalInt(), is(a1_2.getA1_finalInt())); + assertThat(a1_1.getA1_transientInt(), is(a1_2.getA1_transientInt())); + assertThat(a1_1.getA1_ignoredInt(), is(a1_2.getA1_ignoredInt())); + assertThat(a1_1.getA1_ignoredString(), is(a1_2.getA1_ignoredString())); + assertThat(a1_1.getA1_ignoredListString(), is(a1_2.getA1_ignoredListString())); + assertThat(a1_1.isA1_primBool(), is(a1_2.isA1_primBool())); + assertThat(a1_1.getA1_primChar(), is(a1_2.getA1_primChar())); + assertThat(a1_1.getA1_primByte(), is(a1_2.getA1_primByte())); + assertThat(a1_1.getA1_primShort(), is(a1_2.getA1_primShort())); + assertThat(a1_1.getA1_primInt(), is(a1_2.getA1_primInt())); + assertThat(a1_1.getA1_primLong(), is(a1_2.getA1_primLong())); + assertThat(a1_1.getA1_primFloat(), is(a1_2.getA1_primFloat())); + assertThat(a1_1.getA1_primDouble(), is(a1_2.getA1_primDouble())); + assertThat(a1_1.getA1_refBool(), is(a1_2.getA1_refBool())); + assertThat(a1_1.getA1_refChar(), is(a1_2.getA1_refChar())); + assertThat(a1_1.getA1_refByte(), is(a1_2.getA1_refByte())); + assertThat(a1_1.getA1_refShort(), is(a1_2.getA1_refShort())); + assertThat(a1_1.getA1_refInt(), is(a1_2.getA1_refInt())); + assertThat(a1_1.getA1_refLong(), is(a1_2.getA1_refLong())); + assertThat(a1_1.getA1_refFloat(), is(a1_2.getA1_refFloat())); + assertThat(a1_1.getA1_refDouble(), is(a1_2.getA1_refDouble())); + assertThat(a1_1.getA1_string(), is(a1_2.getA1_string())); + assertThat(a1_1.getA1_bigInteger(), is(a1_2.getA1_bigInteger())); + assertThat(a1_1.getA1_bigDecimal(), is(a1_2.getA1_bigDecimal())); + assertThat(a1_1.getA1_localDate(), is(a1_2.getA1_localDate())); + assertThat(a1_1.getA1_localTime(), is(a1_2.getA1_localTime())); + assertThat(a1_1.getA1_localDateTime(), is(a1_2.getA1_localDateTime())); + assertThat(a1_1.getA1_instant(), is(a1_2.getA1_instant())); + assertThat(a1_1.getA1_uuid(), is(a1_2.getA1_uuid())); + assertThat(a1_1.getA1_file(), is(a1_2.getA1_file())); + assertThat(a1_1.getA1_path(), is(a1_2.getA1_path())); + assertThat(a1_1.getA1_url(), is(a1_2.getA1_url())); + assertThat(a1_1.getA1_uri(), is(a1_2.getA1_uri())); + assertThat(a1_1.getA1_uuid(), is(a1_2.getA1_uuid())); + assertThat(a1_1.getA1_Enm(), is(a1_2.getA1_Enm())); + assertThat(a1_1.getA1_b1(), is(a1_2.getA1_b1())); + assertThat(a1_1.getA1_b2(), is(a1_2.getA1_b2())); + assertThat(a1_1.getA1_r1(), is(a1_2.getA1_r1())); + assertThat(a1_1.getA1_r2(), is(a1_2.getA1_r2())); + assertThat(a1_1.getA1_listBoolean(), is(a1_2.getA1_listBoolean())); + assertThat(a1_1.getA1_listChar(), is(a1_2.getA1_listChar())); + assertThat(a1_1.getA1_listByte(), is(a1_2.getA1_listByte())); + assertThat(a1_1.getA1_listShort(), is(a1_2.getA1_listShort())); + assertThat(a1_1.getA1_listInteger(), is(a1_2.getA1_listInteger())); + assertThat(a1_1.getA1_listLong(), is(a1_2.getA1_listLong())); + assertThat(a1_1.getA1_listFloat(), is(a1_2.getA1_listFloat())); + assertThat(a1_1.getA1_listDouble(), is(a1_2.getA1_listDouble())); + assertThat(a1_1.getA1_listString(), is(a1_2.getA1_listString())); + assertThat(a1_1.getA1_listBigInteger(), is(a1_2.getA1_listBigInteger())); + assertThat(a1_1.getA1_listBigDecimal(), is(a1_2.getA1_listBigDecimal())); + assertThat(a1_1.getA1_listLocalDate(), is(a1_2.getA1_listLocalDate())); + assertThat(a1_1.getA1_listLocalTime(), is(a1_2.getA1_listLocalTime())); + assertThat(a1_1.getA1_listLocalDateTime(), is(a1_2.getA1_listLocalDateTime())); + assertThat(a1_1.getA1_listInstant(), is(a1_2.getA1_listInstant())); + assertThat(a1_1.getA1_listUuid(), is(a1_2.getA1_listUuid())); + assertThat(a1_1.getA1_listFile(), is(a1_2.getA1_listFile())); + assertThat(a1_1.getA1_listPath(), is(a1_2.getA1_listPath())); + assertThat(a1_1.getA1_listUrl(), is(a1_2.getA1_listUrl())); + assertThat(a1_1.getA1_listUri(), is(a1_2.getA1_listUri())); + assertThat(a1_1.getA1_listEnm(), is(a1_2.getA1_listEnm())); + assertThat(a1_1.getA1_listB1(), is(a1_2.getA1_listB1())); + assertThat(a1_1.getA1_listB2(), is(a1_2.getA1_listB2())); + assertThat(a1_1.getA1_listR1(), is(a1_2.getA1_listR1())); + assertThat(a1_1.getA1_listR2(), is(a1_2.getA1_listR2())); + assertThat(a1_1.getA1_arrayPrimBoolean(), is(a1_2.getA1_arrayPrimBoolean())); + assertThat(a1_1.getA1_arrayPrimChar(), is(a1_2.getA1_arrayPrimChar())); + assertThat(a1_1.getA1_arrayPrimByte(), is(a1_2.getA1_arrayPrimByte())); + assertThat(a1_1.getA1_arrayPrimShort(), is(a1_2.getA1_arrayPrimShort())); + assertThat(a1_1.getA1_arrayPrimInteger(), is(a1_2.getA1_arrayPrimInteger())); + assertThat(a1_1.getA1_arrayPrimLong(), is(a1_2.getA1_arrayPrimLong())); + assertThat(a1_1.getA1_arrayPrimFloat(), is(a1_2.getA1_arrayPrimFloat())); + assertThat(a1_1.getA1_arrayPrimDouble(), is(a1_2.getA1_arrayPrimDouble())); + assertThat(a1_1.getA1_arrayBoolean(), is(a1_2.getA1_arrayBoolean())); + assertThat(a1_1.getA1_arrayChar(), is(a1_2.getA1_arrayChar())); + assertThat(a1_1.getA1_arrayByte(), is(a1_2.getA1_arrayByte())); + assertThat(a1_1.getA1_arrayShort(), is(a1_2.getA1_arrayShort())); + assertThat(a1_1.getA1_arrayInteger(), is(a1_2.getA1_arrayInteger())); + assertThat(a1_1.getA1_arrayLong(), is(a1_2.getA1_arrayLong())); + assertThat(a1_1.getA1_arrayFloat(), is(a1_2.getA1_arrayFloat())); + assertThat(a1_1.getA1_arrayDouble(), is(a1_2.getA1_arrayDouble())); + assertThat(a1_1.getA1_arrayString(), is(a1_2.getA1_arrayString())); + assertThat(a1_1.getA1_arrayBigInteger(), is(a1_2.getA1_arrayBigInteger())); + assertThat(a1_1.getA1_arrayBigDecimal(), is(a1_2.getA1_arrayBigDecimal())); + assertThat(a1_1.getA1_arrayLocalDate(), is(a1_2.getA1_arrayLocalDate())); + assertThat(a1_1.getA1_arrayLocalTime(), is(a1_2.getA1_arrayLocalTime())); + assertThat(a1_1.getA1_arrayLocalDateTime(), is(a1_2.getA1_arrayLocalDateTime())); + assertThat(a1_1.getA1_arrayUuid(), is(a1_2.getA1_arrayUuid())); + assertThat(a1_1.getA1_arrayEnm(), is(a1_2.getA1_arrayEnm())); + assertThat(a1_1.getA1_arrayB1(), is(a1_2.getA1_arrayB1())); + assertThat(a1_1.getA1_arrayB2(), is(a1_2.getA1_arrayB2())); + assertThat(a1_1.getA1_arrayR1(), is(a1_2.getA1_arrayR1())); + assertThat(a1_1.getA1_arrayR2(), is(a1_2.getA1_arrayR2())); + assertThat(a1_1.getA1_setBoolean(), is(a1_2.getA1_setBoolean())); + assertThat(a1_1.getA1_setChar(), is(a1_2.getA1_setChar())); + assertThat(a1_1.getA1_setByte(), is(a1_2.getA1_setByte())); + assertThat(a1_1.getA1_setShort(), is(a1_2.getA1_setShort())); + assertThat(a1_1.getA1_setInteger(), is(a1_2.getA1_setInteger())); + assertThat(a1_1.getA1_setLong(), is(a1_2.getA1_setLong())); + assertThat(a1_1.getA1_setFloat(), is(a1_2.getA1_setFloat())); + assertThat(a1_1.getA1_setDouble(), is(a1_2.getA1_setDouble())); + assertThat(a1_1.getA1_setString(), is(a1_2.getA1_setString())); + assertThat(a1_1.getA1_setBigInteger(), is(a1_2.getA1_setBigInteger())); + assertThat(a1_1.getA1_setBigDecimal(), is(a1_2.getA1_setBigDecimal())); + assertThat(a1_1.getA1_setLocalDate(), is(a1_2.getA1_setLocalDate())); + assertThat(a1_1.getA1_setLocalTime(), is(a1_2.getA1_setLocalTime())); + assertThat(a1_1.getA1_setLocalDateTime(), is(a1_2.getA1_setLocalDateTime())); + assertThat(a1_1.getA1_setUuid(), is(a1_2.getA1_setUuid())); + assertThat(a1_1.getA1_setEnm(), is(a1_2.getA1_setEnm())); + assertThat(a1_1.getA1_setB1(), is(a1_2.getA1_setB1())); + assertThat(a1_1.getA1_setB2(), is(a1_2.getA1_setB2())); + assertThat(a1_1.getA1_setR1(), is(a1_2.getA1_setR1())); + assertThat(a1_1.getA1_setR2(), is(a1_2.getA1_setR2())); + assertThat(a1_1.getA1_mapBooleanBoolean(), is(a1_2.getA1_mapBooleanBoolean())); + assertThat(a1_1.getA1_mapCharChar(), is(a1_2.getA1_mapCharChar())); + assertThat(a1_1.getA1_mapByteByte(), is(a1_2.getA1_mapByteByte())); + assertThat(a1_1.getA1_mapShortShort(), is(a1_2.getA1_mapShortShort())); + assertThat(a1_1.getA1_mapIntegerInteger(), is(a1_2.getA1_mapIntegerInteger())); + assertThat(a1_1.getA1_mapLongLong(), is(a1_2.getA1_mapLongLong())); + assertThat(a1_1.getA1_mapFloatFloat(), is(a1_2.getA1_mapFloatFloat())); + assertThat(a1_1.getA1_mapDoubleDouble(), is(a1_2.getA1_mapDoubleDouble())); + assertThat(a1_1.getA1_mapStringString(), is(a1_2.getA1_mapStringString())); + assertThat(a1_1.getA1_mapBigIntegerBigInteger(), is(a1_2.getA1_mapBigIntegerBigInteger())); + assertThat(a1_1.getA1_mapBigDecimalBigDecimal(), is(a1_2.getA1_mapBigDecimalBigDecimal())); + assertThat(a1_1.getA1_mapLocalDateLocalDate(), is(a1_2.getA1_mapLocalDateLocalDate())); + assertThat(a1_1.getA1_mapLocalTimeLocalTime(), is(a1_2.getA1_mapLocalTimeLocalTime())); + assertThat(a1_1.getA1_mapLocalDateTimeLocalDateTime(), is(a1_2.getA1_mapLocalDateTimeLocalDateTime())); + assertThat(a1_1.getA1_mapUuidUuid(), is(a1_2.getA1_mapUuidUuid())); + assertThat(a1_1.getA1_mapEnmEnm(), is(a1_2.getA1_mapEnmEnm())); + assertThat(a1_1.getA1_mapIntegerB1(), is(a1_2.getA1_mapIntegerB1())); + assertThat(a1_1.getA1_mapEnmB2(), is(a1_2.getA1_mapEnmB2())); + assertThat(a1_1.getA1_mapStringR1(), is(a1_2.getA1_mapStringR1())); + assertThat(a1_1.getA1_mapStringR2(), is(a1_2.getA1_mapStringR2())); + assertThat(a1_1.getA1_listEmpty(), is(a1_2.getA1_listEmpty())); + assertThat(a1_1.getA1_arrayEmpty(), is(a1_2.getA1_arrayEmpty())); + assertThat(a1_1.getA1_setEmpty(), is(a1_2.getA1_setEmpty())); + assertThat(a1_1.getA1_mapEmpty(), is(a1_2.getA1_mapEmpty())); + assertThat(a1_1.getA1_listListByte(), is(a1_2.getA1_listListByte())); + assertDeepEquals(a1_1.getA1_listArrayFloat(), a1_2.getA1_listArrayFloat(), ArrayList::new); + assertThat(a1_1.getA1_listSetString(), is(a1_2.getA1_listSetString())); + assertThat(a1_1.getA1_listMapEnmLocalDate(), is(a1_2.getA1_listMapEnmLocalDate())); + assertThat(a1_1.getA1_setSetShort(), is(a1_2.getA1_setSetShort())); + assertDeepEquals(a1_1.getA1_setArrayDouble(), a1_2.getA1_setArrayDouble(), HashSet::new); + assertThat(a1_1.getA1_setListString(), is(a1_2.getA1_setListString())); + assertThat(a1_1.getA1_setMapEnmLocalTime(), is(a1_2.getA1_setMapEnmLocalTime())); + assertThat(a1_1.getA1_mapIntegerMapLongBoolean(), is(a1_2.getA1_mapIntegerMapLongBoolean())); + assertThat(a1_1.getA1_mapStringListB1(), is(a1_2.getA1_mapStringListB1())); + assertEquals(a1_2.getA1_mapBigIntegerArrayBigDecimal().keySet(), a1_1.getA1_mapBigIntegerArrayBigDecimal().keySet()); + assertDeepEquals(a1_2.getA1_mapBigIntegerArrayBigDecimal().values(), a1_2.getA1_mapBigIntegerArrayBigDecimal().values(), HashSet::new); + assertThat(a1_1.getA1_mapEnmSetB2(), is(a1_2.getA1_mapEnmSetB2())); + assertThat(a1_1.getA1_mapIntegerListMapShortSetB2(), is(a1_2.getA1_mapIntegerListMapShortSetB2())); + assertThat(a1_1.getA1_arrayArrayPrimBoolean(), is(a1_2.getA1_arrayArrayPrimBoolean())); + assertThat(a1_1.getA1_arrayArrayPrimChar(), is(a1_2.getA1_arrayArrayPrimChar())); + assertThat(a1_1.getA1_arrayArrayPrimByte(), is(a1_2.getA1_arrayArrayPrimByte())); + assertThat(a1_1.getA1_arrayArrayPrimShort(), is(a1_2.getA1_arrayArrayPrimShort())); + assertThat(a1_1.getA1_arrayArrayPrimInteger(), is(a1_2.getA1_arrayArrayPrimInteger())); + assertThat(a1_1.getA1_arrayArrayPrimLong(), is(a1_2.getA1_arrayArrayPrimLong())); + assertThat(a1_1.getA1_arrayArrayPrimFloat(), is(a1_2.getA1_arrayArrayPrimFloat())); + assertThat(a1_1.getA1_arrayArrayPrimDouble(), is(a1_2.getA1_arrayArrayPrimDouble())); + assertThat(a1_1.getA1_arrayArrayBoolean(), is(a1_2.getA1_arrayArrayBoolean())); + assertThat(a1_1.getA1_arrayArrayChar(), is(a1_2.getA1_arrayArrayChar())); + assertThat(a1_1.getA1_arrayArrayByte(), is(a1_2.getA1_arrayArrayByte())); + assertThat(a1_1.getA1_arrayArrayShort(), is(a1_2.getA1_arrayArrayShort())); + assertThat(a1_1.getA1_arrayArrayInteger(), is(a1_2.getA1_arrayArrayInteger())); + assertThat(a1_1.getA1_arrayArrayLong(), is(a1_2.getA1_arrayArrayLong())); + assertThat(a1_1.getA1_arrayArrayFloat(), is(a1_2.getA1_arrayArrayFloat())); + assertThat(a1_1.getA1_arrayArrayDouble(), is(a1_2.getA1_arrayArrayDouble())); + assertThat(a1_1.getA1_arrayArrayString(), is(a1_2.getA1_arrayArrayString())); + assertThat(a1_1.getA1_arrayArrayBigInteger(), is(a1_2.getA1_arrayArrayBigInteger())); + assertThat(a1_1.getA1_arrayArrayBigDecimal(), is(a1_2.getA1_arrayArrayBigDecimal())); + assertThat(a1_1.getA1_arrayArrayLocalDate(), is(a1_2.getA1_arrayArrayLocalDate())); + assertThat(a1_1.getA1_arrayArrayLocalTime(), is(a1_2.getA1_arrayArrayLocalTime())); + assertThat(a1_1.getA1_arrayArrayLocalDateTime(), is(a1_2.getA1_arrayArrayLocalDateTime())); + assertThat(a1_1.getA1_arrayArrayUuid(), is(a1_2.getA1_arrayArrayUuid())); + assertThat(a1_1.getA1_arrayArrayEnm(), is(a1_2.getA1_arrayArrayEnm())); + assertThat(a1_1.getA1_arrayArrayB1(), is(a1_2.getA1_arrayArrayB1())); + assertThat(a1_1.getA1_arrayArrayB2(), is(a1_2.getA1_arrayArrayB2())); + assertThat(a1_1.getA1_arrayArrayR1(), is(a1_2.getA1_arrayArrayR1())); + assertThat(a1_1.getA1_arrayArrayR2(), is(a1_2.getA1_arrayArrayR2())); + assertThat(a1_1.getA1_point(), is(a1_2.getA1_point())); + assertThat(a1_1.getA1_listPoint(), is(a1_2.getA1_listPoint())); + assertThat(a1_1.getA1_arrayPoint(), is(a1_2.getA1_arrayPoint())); + assertThat(a1_1.getA1_setPoint(), is(a1_2.getA1_setPoint())); + assertThat(a1_1.getA1_mapEnmListPoint(), is(a1_2.getA1_mapEnmListPoint())); + } + + public static void assertExampleConfigurationsA2Equal( + ExampleConfigurationA2 a2_1, + ExampleConfigurationA2 a2_2 + ) { + assertThat(ExampleConfigurationA2.getA1_staticFinalInt(), is(1)); + assertThat(ExampleConfigurationA2.getA1_staticInt(), is(2)); + + assertExampleConfigurationsA1Equal(a2_1, a2_2); + + assertThat(a2_1.getA2_finalInt(), is(a2_2.getA2_finalInt())); + assertThat(a2_1.getA2_transientInt(), is(a2_2.getA2_transientInt())); + assertThat(a2_1.getA2_ignoredInt(), is(a2_2.getA2_ignoredInt())); + assertThat(a2_1.getA2_ignoredString(), is(a2_2.getA2_ignoredString())); + assertThat(a2_1.getA2_ignoredListString(), is(a2_2.getA2_ignoredListString())); + assertThat(a2_1.isA2_primBool(), is(a2_2.isA2_primBool())); + assertThat(a2_1.getA2_primChar(), is(a2_2.getA2_primChar())); + assertThat(a2_1.getA2_primByte(), is(a2_2.getA2_primByte())); + assertThat(a2_1.getA2_primShort(), is(a2_2.getA2_primShort())); + assertThat(a2_1.getA2_primInt(), is(a2_2.getA2_primInt())); + assertThat(a2_1.getA2_primLong(), is(a2_2.getA2_primLong())); + assertThat(a2_1.getA2_primFloat(), is(a2_2.getA2_primFloat())); + assertThat(a2_1.getA2_primDouble(), is(a2_2.getA2_primDouble())); + assertThat(a2_1.getA2_refBool(), is(a2_2.getA2_refBool())); + assertThat(a2_1.getA2_refChar(), is(a2_2.getA2_refChar())); + assertThat(a2_1.getA2_refByte(), is(a2_2.getA2_refByte())); + assertThat(a2_1.getA2_refShort(), is(a2_2.getA2_refShort())); + assertThat(a2_1.getA2_refInt(), is(a2_2.getA2_refInt())); + assertThat(a2_1.getA2_refLong(), is(a2_2.getA2_refLong())); + assertThat(a2_1.getA2_refFloat(), is(a2_2.getA2_refFloat())); + assertThat(a2_1.getA2_refDouble(), is(a2_2.getA2_refDouble())); + assertThat(a2_1.getA2_string(), is(a2_2.getA2_string())); + assertThat(a2_1.getA2_bigInteger(), is(a2_2.getA2_bigInteger())); + assertThat(a2_1.getA2_bigDecimal(), is(a2_2.getA2_bigDecimal())); + assertThat(a2_1.getA2_localDate(), is(a2_2.getA2_localDate())); + assertThat(a2_1.getA2_localTime(), is(a2_2.getA2_localTime())); + assertThat(a2_1.getA2_localDateTime(), is(a2_2.getA2_localDateTime())); + assertThat(a2_1.getA2_instant(), is(a2_2.getA2_instant())); + assertThat(a2_1.getA2_uuid(), is(a2_2.getA2_uuid())); + assertThat(a2_1.getA2_file(), is(a2_2.getA2_file())); + assertThat(a2_1.getA2_path(), is(a2_2.getA2_path())); + assertThat(a2_1.getA2_url(), is(a2_2.getA2_url())); + assertThat(a2_1.getA2_uri(), is(a2_2.getA2_uri())); + assertThat(a2_1.getA2_Enm(), is(a2_2.getA2_Enm())); + assertThat(a2_1.getA2_b1(), is(a2_2.getA2_b1())); + assertThat(a2_1.getA2_b2(), is(a2_2.getA2_b2())); + assertThat(a2_1.getA2_r1(), is(a2_2.getA2_r1())); + assertThat(a2_1.getA2_r2(), is(a2_2.getA2_r2())); + assertThat(a2_1.getA2_listBoolean(), is(a2_2.getA2_listBoolean())); + assertThat(a2_1.getA2_listChar(), is(a2_2.getA2_listChar())); + assertThat(a2_1.getA2_listByte(), is(a2_2.getA2_listByte())); + assertThat(a2_1.getA2_listShort(), is(a2_2.getA2_listShort())); + assertThat(a2_1.getA2_listInteger(), is(a2_2.getA2_listInteger())); + assertThat(a2_1.getA2_listLong(), is(a2_2.getA2_listLong())); + assertThat(a2_1.getA2_listFloat(), is(a2_2.getA2_listFloat())); + assertThat(a2_1.getA2_listDouble(), is(a2_2.getA2_listDouble())); + assertThat(a2_1.getA2_listString(), is(a2_2.getA2_listString())); + assertThat(a2_1.getA2_listBigInteger(), is(a2_2.getA2_listBigInteger())); + assertThat(a2_1.getA2_listBigDecimal(), is(a2_2.getA2_listBigDecimal())); + assertThat(a2_1.getA2_listLocalDate(), is(a2_2.getA2_listLocalDate())); + assertThat(a2_1.getA2_listLocalTime(), is(a2_2.getA2_listLocalTime())); + assertThat(a2_1.getA2_listLocalDateTime(), is(a2_2.getA2_listLocalDateTime())); + assertThat(a2_1.getA2_listInstant(), is(a2_2.getA2_listInstant())); + assertThat(a2_1.getA2_listUuid(), is(a2_2.getA2_listUuid())); + assertThat(a2_1.getA2_listFile(), is(a2_2.getA2_listFile())); + assertThat(a2_1.getA2_listPath(), is(a2_2.getA2_listPath())); + assertThat(a2_1.getA2_listUrl(), is(a2_2.getA2_listUrl())); + assertThat(a2_1.getA2_listUri(), is(a2_2.getA2_listUri())); + assertThat(a2_1.getA2_listEnm(), is(a2_2.getA2_listEnm())); + assertThat(a2_1.getA2_listB1(), is(a2_2.getA2_listB1())); + assertThat(a2_1.getA2_listB2(), is(a2_2.getA2_listB2())); + assertThat(a2_1.getA2_listR1(), is(a2_2.getA2_listR1())); + assertThat(a2_1.getA2_listR2(), is(a2_2.getA2_listR2())); + assertThat(a2_1.getA2_arrayPrimBoolean(), is(a2_2.getA2_arrayPrimBoolean())); + assertThat(a2_1.getA2_arrayPrimChar(), is(a2_2.getA2_arrayPrimChar())); + assertThat(a2_1.getA2_arrayPrimByte(), is(a2_2.getA2_arrayPrimByte())); + assertThat(a2_1.getA2_arrayPrimShort(), is(a2_2.getA2_arrayPrimShort())); + assertThat(a2_1.getA2_arrayPrimInteger(), is(a2_2.getA2_arrayPrimInteger())); + assertThat(a2_1.getA2_arrayPrimLong(), is(a2_2.getA2_arrayPrimLong())); + assertThat(a2_1.getA2_arrayPrimFloat(), is(a2_2.getA2_arrayPrimFloat())); + assertThat(a2_1.getA2_arrayPrimDouble(), is(a2_2.getA2_arrayPrimDouble())); + assertThat(a2_1.getA2_arrayBoolean(), is(a2_2.getA2_arrayBoolean())); + assertThat(a2_1.getA2_arrayChar(), is(a2_2.getA2_arrayChar())); + assertThat(a2_1.getA2_arrayByte(), is(a2_2.getA2_arrayByte())); + assertThat(a2_1.getA2_arrayShort(), is(a2_2.getA2_arrayShort())); + assertThat(a2_1.getA2_arrayInteger(), is(a2_2.getA2_arrayInteger())); + assertThat(a2_1.getA2_arrayLong(), is(a2_2.getA2_arrayLong())); + assertThat(a2_1.getA2_arrayFloat(), is(a2_2.getA2_arrayFloat())); + assertThat(a2_1.getA2_arrayDouble(), is(a2_2.getA2_arrayDouble())); + assertThat(a2_1.getA2_arrayString(), is(a2_2.getA2_arrayString())); + assertThat(a2_1.getA2_arrayBigInteger(), is(a2_2.getA2_arrayBigInteger())); + assertThat(a2_1.getA2_arrayBigDecimal(), is(a2_2.getA2_arrayBigDecimal())); + assertThat(a2_1.getA2_arrayLocalDate(), is(a2_2.getA2_arrayLocalDate())); + assertThat(a2_1.getA2_arrayLocalTime(), is(a2_2.getA2_arrayLocalTime())); + assertThat(a2_1.getA2_arrayLocalDateTime(), is(a2_2.getA2_arrayLocalDateTime())); + assertThat(a2_1.getA2_arrayUuid(), is(a2_2.getA2_arrayUuid())); + assertThat(a2_1.getA2_arrayEnm(), is(a2_2.getA2_arrayEnm())); + assertThat(a2_1.getA2_arrayB1(), is(a2_2.getA2_arrayB1())); + assertThat(a2_1.getA2_arrayB2(), is(a2_2.getA2_arrayB2())); + assertThat(a2_1.getA2_arrayR1(), is(a2_2.getA2_arrayR1())); + assertThat(a2_1.getA2_arrayR2(), is(a2_2.getA2_arrayR2())); + assertThat(a2_1.getA2_setBoolean(), is(a2_2.getA2_setBoolean())); + assertThat(a2_1.getA2_setChar(), is(a2_2.getA2_setChar())); + assertThat(a2_1.getA2_setByte(), is(a2_2.getA2_setByte())); + assertThat(a2_1.getA2_setShort(), is(a2_2.getA2_setShort())); + assertThat(a2_1.getA2_setInteger(), is(a2_2.getA2_setInteger())); + assertThat(a2_1.getA2_setLong(), is(a2_2.getA2_setLong())); + assertThat(a2_1.getA2_setFloat(), is(a2_2.getA2_setFloat())); + assertThat(a2_1.getA2_setDouble(), is(a2_2.getA2_setDouble())); + assertThat(a2_1.getA2_setString(), is(a2_2.getA2_setString())); + assertThat(a2_1.getA2_setBigInteger(), is(a2_2.getA2_setBigInteger())); + assertThat(a2_1.getA2_setBigDecimal(), is(a2_2.getA2_setBigDecimal())); + assertThat(a2_1.getA2_setLocalDate(), is(a2_2.getA2_setLocalDate())); + assertThat(a2_1.getA2_setLocalTime(), is(a2_2.getA2_setLocalTime())); + assertThat(a2_1.getA2_setLocalDateTime(), is(a2_2.getA2_setLocalDateTime())); + assertThat(a2_1.getA2_setUuid(), is(a2_2.getA2_setUuid())); + assertThat(a2_1.getA2_setEnm(), is(a2_2.getA2_setEnm())); + assertThat(a2_1.getA2_setB1(), is(a2_2.getA2_setB1())); + assertThat(a2_1.getA2_setB2(), is(a2_2.getA2_setB2())); + assertThat(a2_1.getA2_setR1(), is(a2_2.getA2_setR1())); + assertThat(a2_1.getA2_setR2(), is(a2_2.getA2_setR2())); + assertThat(a2_1.getA2_mapBooleanBoolean(), is(a2_2.getA2_mapBooleanBoolean())); + assertThat(a2_1.getA2_mapCharChar(), is(a2_2.getA2_mapCharChar())); + assertThat(a2_1.getA2_mapByteByte(), is(a2_2.getA2_mapByteByte())); + assertThat(a2_1.getA2_mapShortShort(), is(a2_2.getA2_mapShortShort())); + assertThat(a2_1.getA2_mapIntegerInteger(), is(a2_2.getA2_mapIntegerInteger())); + assertThat(a2_1.getA2_mapLongLong(), is(a2_2.getA2_mapLongLong())); + assertThat(a2_1.getA2_mapFloatFloat(), is(a2_2.getA2_mapFloatFloat())); + assertThat(a2_1.getA2_mapDoubleDouble(), is(a2_2.getA2_mapDoubleDouble())); + assertThat(a2_1.getA2_mapStringString(), is(a2_2.getA2_mapStringString())); + assertThat(a2_1.getA2_mapBigIntegerBigInteger(), is(a2_2.getA2_mapBigIntegerBigInteger())); + assertThat(a2_1.getA2_mapBigDecimalBigDecimal(), is(a2_2.getA2_mapBigDecimalBigDecimal())); + assertThat(a2_1.getA2_mapLocalDateLocalDate(), is(a2_2.getA2_mapLocalDateLocalDate())); + assertThat(a2_1.getA2_mapLocalTimeLocalTime(), is(a2_2.getA2_mapLocalTimeLocalTime())); + assertThat(a2_1.getA2_mapLocalDateTimeLocalDateTime(), is(a2_2.getA2_mapLocalDateTimeLocalDateTime())); + assertThat(a2_1.getA2_mapUuidUuid(), is(a2_2.getA2_mapUuidUuid())); + assertThat(a2_1.getA2_mapEnmEnm(), is(a2_2.getA2_mapEnmEnm())); + assertThat(a2_1.getA2_mapIntegerB1(), is(a2_2.getA2_mapIntegerB1())); + assertThat(a2_1.getA2_mapEnmB2(), is(a2_2.getA2_mapEnmB2())); + assertThat(a2_1.getA2_mapStringR1(), is(a2_2.getA2_mapStringR1())); + assertThat(a2_1.getA2_mapStringR2(), is(a2_2.getA2_mapStringR2())); + assertThat(a2_1.getA2_listEmpty(), is(a2_2.getA2_listEmpty())); + assertThat(a2_1.getA2_arrayEmpty(), is(a2_2.getA2_arrayEmpty())); + assertThat(a2_1.getA2_setEmpty(), is(a2_2.getA2_setEmpty())); + assertThat(a2_1.getA2_mapEmpty(), is(a2_2.getA2_mapEmpty())); + assertThat(a2_1.getA2_listListByte(), is(a2_2.getA2_listListByte())); + assertDeepEquals(a2_1.getA2_listArrayFloat(), a2_2.getA2_listArrayFloat(), ArrayList::new); + assertThat(a2_1.getA2_listSetString(), is(a2_2.getA2_listSetString())); + assertThat(a2_1.getA2_listMapEnmLocalDate(), is(a2_2.getA2_listMapEnmLocalDate())); + assertThat(a2_1.getA2_setSetShort(), is(a2_2.getA2_setSetShort())); + assertDeepEquals(a2_1.getA2_setArrayDouble(), a2_2.getA2_setArrayDouble(), HashSet::new); + assertThat(a2_1.getA2_setListString(), is(a2_2.getA2_setListString())); + assertThat(a2_1.getA2_setMapEnmLocalTime(), is(a2_2.getA2_setMapEnmLocalTime())); + assertThat(a2_1.getA2_mapIntegerMapLongBoolean(), is(a2_2.getA2_mapIntegerMapLongBoolean())); + assertThat(a2_1.getA2_mapStringListB1(), is(a2_2.getA2_mapStringListB1())); + assertEquals(a2_2.getA2_mapBigIntegerArrayBigDecimal().keySet(), a2_1.getA2_mapBigIntegerArrayBigDecimal().keySet()); + assertDeepEquals(a2_2.getA2_mapBigIntegerArrayBigDecimal().values(), a2_2.getA2_mapBigIntegerArrayBigDecimal().values(), HashSet::new); + assertThat(a2_1.getA2_mapEnmSetB2(), is(a2_2.getA2_mapEnmSetB2())); + assertThat(a2_1.getA2_mapIntegerListMapShortSetB2(), is(a2_2.getA2_mapIntegerListMapShortSetB2())); + assertThat(a2_1.getA2_arrayArrayPrimBoolean(), is(a2_2.getA2_arrayArrayPrimBoolean())); + assertThat(a2_1.getA2_arrayArrayPrimChar(), is(a2_2.getA2_arrayArrayPrimChar())); + assertThat(a2_1.getA2_arrayArrayPrimByte(), is(a2_2.getA2_arrayArrayPrimByte())); + assertThat(a2_1.getA2_arrayArrayPrimShort(), is(a2_2.getA2_arrayArrayPrimShort())); + assertThat(a2_1.getA2_arrayArrayPrimInteger(), is(a2_2.getA2_arrayArrayPrimInteger())); + assertThat(a2_1.getA2_arrayArrayPrimLong(), is(a2_2.getA2_arrayArrayPrimLong())); + assertThat(a2_1.getA2_arrayArrayPrimFloat(), is(a2_2.getA2_arrayArrayPrimFloat())); + assertThat(a2_1.getA2_arrayArrayPrimDouble(), is(a2_2.getA2_arrayArrayPrimDouble())); + assertThat(a2_1.getA2_arrayArrayBoolean(), is(a2_2.getA2_arrayArrayBoolean())); + assertThat(a2_1.getA2_arrayArrayChar(), is(a2_2.getA2_arrayArrayChar())); + assertThat(a2_1.getA2_arrayArrayByte(), is(a2_2.getA2_arrayArrayByte())); + assertThat(a2_1.getA2_arrayArrayShort(), is(a2_2.getA2_arrayArrayShort())); + assertThat(a2_1.getA2_arrayArrayInteger(), is(a2_2.getA2_arrayArrayInteger())); + assertThat(a2_1.getA2_arrayArrayLong(), is(a2_2.getA2_arrayArrayLong())); + assertThat(a2_1.getA2_arrayArrayFloat(), is(a2_2.getA2_arrayArrayFloat())); + assertThat(a2_1.getA2_arrayArrayDouble(), is(a2_2.getA2_arrayArrayDouble())); + assertThat(a2_1.getA2_arrayArrayString(), is(a2_2.getA2_arrayArrayString())); + assertThat(a2_1.getA2_arrayArrayBigInteger(), is(a2_2.getA2_arrayArrayBigInteger())); + assertThat(a2_1.getA2_arrayArrayBigDecimal(), is(a2_2.getA2_arrayArrayBigDecimal())); + assertThat(a2_1.getA2_arrayArrayLocalDate(), is(a2_2.getA2_arrayArrayLocalDate())); + assertThat(a2_1.getA2_arrayArrayLocalTime(), is(a2_2.getA2_arrayArrayLocalTime())); + assertThat(a2_1.getA2_arrayArrayLocalDateTime(), is(a2_2.getA2_arrayArrayLocalDateTime())); + assertThat(a2_1.getA2_arrayArrayUuid(), is(a2_2.getA2_arrayArrayUuid())); + assertThat(a2_1.getA2_arrayArrayEnm(), is(a2_2.getA2_arrayArrayEnm())); + assertThat(a2_1.getA2_arrayArrayB1(), is(a2_2.getA2_arrayArrayB1())); + assertThat(a2_1.getA2_arrayArrayB2(), is(a2_2.getA2_arrayArrayB2())); + assertThat(a2_1.getA2_arrayArrayR1(), is(a2_2.getA2_arrayArrayR1())); + assertThat(a2_1.getA2_arrayArrayR2(), is(a2_2.getA2_arrayArrayR2())); + assertThat(a2_1.getA2_point(), is(a2_2.getA2_point())); + assertThat(a2_1.getA2_listPoint(), is(a2_2.getA2_listPoint())); + assertThat(a2_1.getA2_arrayPoint(), is(a2_2.getA2_arrayPoint())); + assertThat(a2_1.getA2_setPoint(), is(a2_2.getA2_setPoint())); + assertThat(a2_1.getA2_mapEnmListPoint(), is(a2_2.getA2_mapEnmListPoint())); + } + + + public static void assertExampleConfigurationsB1Equal( + ExampleConfigurationB1 b1_1, + ExampleConfigurationB1 b1_2 + ) { + assertThat(ExampleConfigurationB1.getB1_staticFinalInt(), is(1)); + assertThat(ExampleConfigurationB1.getB1_staticInt(), is(2)); + + assertThat(b1_1.getB1_finalInt(), is(b1_2.getB1_finalInt())); + assertThat(b1_1.getB1_transientInt(), is(b1_2.getB1_transientInt())); + assertThat(b1_1.getB1_ignoredInt(), is(b1_2.getB1_ignoredInt())); + assertThat(b1_1.getB1_ignoredString(), is(b1_2.getB1_ignoredString())); + assertThat(b1_1.getB1_ignoredListString(), is(b1_2.getB1_ignoredListString())); + assertThat(b1_1.isB1_primBool(), is(b1_2.isB1_primBool())); + assertThat(b1_1.getB1_refChar(), is(b1_2.getB1_refChar())); + assertThat(b1_1.getB1_string(), is(b1_2.getB1_string())); + assertThat(b1_1.getB1_listByte(), is(b1_2.getB1_listByte())); + assertThat(b1_1.getB1_arrayShort(), is(b1_2.getB1_arrayShort())); + assertThat(b1_1.getB1_setInteger(), is(b1_2.getB1_setInteger())); + assertThat(b1_1.getB1_listEmpty(), is(b1_2.getB1_listEmpty())); + assertThat(b1_1.getB1_mapLongLong(), is(b1_2.getB1_mapLongLong())); + assertThat(b1_1.getB1_listListByte(), is(b1_2.getB1_listListByte())); + assertThat(b1_1.getB1_point(), is(b1_2.getB1_point())); + assertEquals(b1_2, b1_1); + } + + public static void assertExampleConfigurationsB2Equal( + ExampleConfigurationB2 b2_1, + ExampleConfigurationB2 b2_2 + ) { + assertExampleConfigurationsB1Equal(b2_1, b2_2); + + assertThat(ExampleConfigurationB2.getB1_staticFinalInt(), is(1)); + assertThat(ExampleConfigurationB2.getB1_staticInt(), is(2)); + + assertThat(b2_1.getB2_finalInt(), is(b2_2.getB2_finalInt())); + assertThat(b2_1.getB2_transientInt(), is(b2_2.getB2_transientInt())); + assertThat(b2_1.getB2_ignoredInt(), is(b2_2.getB2_ignoredInt())); + assertThat(b2_1.getB2_ignoredString(), is(b2_2.getB2_ignoredString())); + assertThat(b2_1.getB2_ignoredListString(), is(b2_2.getB2_ignoredListString())); + assertThat(b2_1.getB2_primChar(), is(b2_2.getB2_primChar())); + assertThat(b2_1.getB2_refBool(), is(b2_2.getB2_refBool())); + assertThat(b2_1.getB2_bigInteger(), is(b2_2.getB2_bigInteger())); + assertThat(b2_1.getB2_listShort(), is(b2_2.getB2_listShort())); + assertThat(b2_1.getB2_arrayInteger(), is(b2_2.getB2_arrayInteger())); + assertThat(b2_1.getB2_setLong(), is(b2_2.getB2_setLong())); + assertThat(b2_1.getB2_arrayEmpty(), is(b2_2.getB2_arrayEmpty())); + assertThat(b2_1.getB2_mapFloatFloat(), is(b2_2.getB2_mapFloatFloat())); + assertDeepEquals(b2_1.getB2_setArrayDouble(), b2_2.getB2_setArrayDouble(), LinkedHashSet::new); + assertThat(b2_1.getB2_listPoint(), is(b2_2.getB2_listPoint())); + assertEquals(b2_2, b2_1); + } + + public static > void assertDeepEquals( + C collection1, + C collection2, + Supplier>> collectionFactory + ) { + Collection> c1 = collection1.stream().map(Arrays::asList) + .collect(Collectors.toCollection(collectionFactory)); + Collection> c2 = collection2.stream().map(Arrays::asList) + .collect(Collectors.toCollection(collectionFactory)); + assertEquals(c2, c1); + } +} diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleInitializer.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleInitializer.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleInitializer.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleInitializer.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleRecord1.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleRecord1.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleRecord1.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleRecord1.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleRecord2.java b/configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleRecord2.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/configurations/ExampleRecord2.java rename to configlib-core/src/testFixtures/java/de/exlll/configlib/configurations/ExampleRecord2.java diff --git a/configlib-paper/build.gradle.kts b/configlib-paper/build.gradle.kts index bdb7400..5605818 100644 --- a/configlib-paper/build.gradle.kts +++ b/configlib-paper/build.gradle.kts @@ -1,10 +1,8 @@ plugins { - `java-config` + `core-config` + `plugins-config` } dependencies { - shade(project(":configlib-core")) - implementation("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT") -} - -tasks.jar { from(project(":configlib-core").sourceSets["main"].output) } \ No newline at end of file + compileOnly("io.papermc.paper:paper-api:1.19-R0.1-SNAPSHOT") +} \ No newline at end of file diff --git a/configlib-velocity/build.gradle.kts b/configlib-velocity/build.gradle.kts index 9a6c87e..18ae525 100644 --- a/configlib-velocity/build.gradle.kts +++ b/configlib-velocity/build.gradle.kts @@ -1,11 +1,9 @@ plugins { - `java-config` + `core-config` + `plugins-config` } dependencies { - shade(project(":configlib-core")) - implementation("com.velocitypowered:velocity-api:3.0.1") + compileOnly("com.velocitypowered:velocity-api:3.0.1") annotationProcessor("com.velocitypowered:velocity-api:3.0.1") -} - -tasks.jar { from(project(":configlib-core").sourceSets["main"].output) } \ No newline at end of file +} \ No newline at end of file diff --git a/configlib-waterfall/build.gradle.kts b/configlib-waterfall/build.gradle.kts index 4338ac7..55698a6 100644 --- a/configlib-waterfall/build.gradle.kts +++ b/configlib-waterfall/build.gradle.kts @@ -1,10 +1,8 @@ plugins { - `java-config` + `core-config` + `plugins-config` } dependencies { - shade(project(":configlib-core")) - implementation("io.github.waterfallmc:waterfall-api:1.19-R0.1-SNAPSHOT") -} - -tasks.jar { from(project(":configlib-core").sourceSets["main"].output) } \ No newline at end of file + compileOnly("io.github.waterfallmc:waterfall-api:1.19-R0.1-SNAPSHOT") +} \ No newline at end of file diff --git a/configlib-yaml/build.gradle.kts b/configlib-yaml/build.gradle.kts new file mode 100644 index 0000000..c70690f --- /dev/null +++ b/configlib-yaml/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + `core-config` + `libs-config` +} + +dependencies { + implementation("org.snakeyaml:snakeyaml-engine:2.3") +} \ No newline at end of file diff --git a/configlib-core/src/main/java/de/exlll/configlib/YamlConfigurationProperties.java b/configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurationProperties.java similarity index 100% rename from configlib-core/src/main/java/de/exlll/configlib/YamlConfigurationProperties.java rename to configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurationProperties.java diff --git a/configlib-core/src/main/java/de/exlll/configlib/YamlConfigurationStore.java b/configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurationStore.java similarity index 100% rename from configlib-core/src/main/java/de/exlll/configlib/YamlConfigurationStore.java rename to configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurationStore.java diff --git a/configlib-core/src/main/java/de/exlll/configlib/Configurations.java b/configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurations.java similarity index 87% rename from configlib-core/src/main/java/de/exlll/configlib/Configurations.java rename to configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurations.java index 3407fc4..a5ab1de 100644 --- a/configlib-core/src/main/java/de/exlll/configlib/Configurations.java +++ b/configlib-yaml/src/main/java/de/exlll/configlib/YamlConfigurations.java @@ -6,8 +6,8 @@ import java.util.function.Consumer; /** * This class contains convenience methods for loading, saving, and updating configurations. */ -public final class Configurations { - private Configurations() {} +public final class YamlConfigurations { + private YamlConfigurations() {} /** * Loads a configuration of the given type from the specified YAML file using a @@ -23,12 +23,12 @@ public final class Configurations { * @throws RuntimeException if reading the configuration throws an exception * @see YamlConfigurationStore#load(Path) */ - public static T loadYamlConfiguration( + public static T loadConfiguration( Path configurationFile, Class configurationType ) { final var properties = YamlConfigurationProperties.newBuilder().build(); - return loadYamlConfiguration(configurationFile, configurationType, properties); + return loadConfiguration(configurationFile, configurationType, properties); } /** @@ -47,14 +47,14 @@ public final class Configurations { * @throws RuntimeException if reading the configuration throws an exception * @see YamlConfigurationStore#load(Path) */ - public static T loadYamlConfiguration( + public static T loadConfiguration( Path configurationFile, Class configurationType, Consumer> propertiesConfigurer ) { final var builder = YamlConfigurationProperties.newBuilder(); propertiesConfigurer.accept(builder); - return loadYamlConfiguration(configurationFile, configurationType, builder.build()); + return loadConfiguration(configurationFile, configurationType, builder.build()); } /** @@ -72,7 +72,7 @@ public final class Configurations { * @throws RuntimeException if reading the configuration throws an exception * @see YamlConfigurationStore#load(Path) */ - public static T loadYamlConfiguration( + public static T loadConfiguration( Path configurationFile, Class configurationType, YamlConfigurationProperties properties @@ -85,7 +85,7 @@ public final class Configurations { * Updates a YAML configuration file with a configuration of the given type using a * {@code YamlConfigurationProperties} object with default values. *

- * See {@link YamlConfigurationStore#save(Object, Path)} for an explanation of how the update is // TODO: change #save to #update + * See {@link YamlConfigurationStore#update(Path)} for an explanation of how the update is done. * done. * * @param configurationFile the configuration file that is updated @@ -97,12 +97,12 @@ public final class Configurations { * @throws RuntimeException if loading or saving the configuration throws an exception * @see YamlConfigurationStore#update(Path) */ - public static T updateYamlConfiguration( + public static T updateConfiguration( Path configurationFile, Class configurationType ) { final var properties = YamlConfigurationProperties.newBuilder().build(); - return updateYamlConfiguration(configurationFile, configurationType, properties); + return updateConfiguration(configurationFile, configurationType, properties); } /** @@ -110,8 +110,7 @@ public final class Configurations { * {@code YamlConfigurationProperties} object that is built by a builder. The builder is * initialized with default values and can be configured by the {@code propertiesConfigurer}. *

- * See {@link YamlConfigurationStore#save(Object, Path)} for an explanation of how the update is - * done. + * See {@link YamlConfigurationStore#update(Path)} for an explanation of how the update is done. * * @param configurationFile the configuration file that is updated * @param configurationType the type of configuration @@ -123,22 +122,21 @@ public final class Configurations { * @throws RuntimeException if loading or saving the configuration throws an exception * @see YamlConfigurationStore#update(Path) */ - public static T updateYamlConfiguration( + public static T updateConfiguration( Path configurationFile, Class configurationType, Consumer> propertiesConfigurer ) { final var builder = YamlConfigurationProperties.newBuilder(); propertiesConfigurer.accept(builder); - return updateYamlConfiguration(configurationFile, configurationType, builder.build()); + return updateConfiguration(configurationFile, configurationType, builder.build()); } /** * Updates a YAML configuration file with a configuration of the given type using the given * {@code YamlConfigurationProperties} object. *

- * See {@link YamlConfigurationStore#save(Object, Path)} for an explanation of how the update is - * done. + * See {@link YamlConfigurationStore#update(Path)} for an explanation of how the update is done. * * @param configurationFile the configuration file that is updated * @param configurationType the type of configuration @@ -150,7 +148,7 @@ public final class Configurations { * @throws RuntimeException if loading or saving the configuration throws an exception * @see YamlConfigurationStore#update(Path) */ - public static T updateYamlConfiguration( + public static T updateConfiguration( Path configurationFile, Class configurationType, YamlConfigurationProperties properties @@ -173,13 +171,13 @@ public final class Configurations { * @throws RuntimeException if writing the configuration throws an exception * @see YamlConfigurationStore#save(Object, Path) */ - public static void saveYamlConfiguration( + public static void saveConfiguration( Path configurationFile, Class configurationType, T configuration ) { final var properties = YamlConfigurationProperties.newBuilder().build(); - saveYamlConfiguration(configurationFile, configurationType, configuration, properties); + saveConfiguration(configurationFile, configurationType, configuration, properties); } /** @@ -198,7 +196,7 @@ public final class Configurations { * @throws RuntimeException if writing the configuration throws an exception * @see YamlConfigurationStore#save(Object, Path) */ - public static void saveYamlConfiguration( + public static void saveConfiguration( Path configurationFile, Class configurationType, T configuration, @@ -206,7 +204,7 @@ public final class Configurations { ) { final var builder = YamlConfigurationProperties.newBuilder(); propertiesConfigurer.accept(builder); - saveYamlConfiguration(configurationFile, configurationType, configuration, builder.build()); + saveConfiguration(configurationFile, configurationType, configuration, builder.build()); } /** @@ -224,7 +222,7 @@ public final class Configurations { * @throws RuntimeException if writing the configuration throws an exception * @see YamlConfigurationStore#save(Object, Path) */ - public static void saveYamlConfiguration( + public static void saveConfiguration( Path configurationFile, Class configurationType, T configuration, diff --git a/configlib-yaml/src/test/java/de/exlll/configlib/ExampleConfigurationYamlTests.java b/configlib-yaml/src/test/java/de/exlll/configlib/ExampleConfigurationYamlTests.java new file mode 100644 index 0000000..acca592 --- /dev/null +++ b/configlib-yaml/src/test/java/de/exlll/configlib/ExampleConfigurationYamlTests.java @@ -0,0 +1,84 @@ +package de.exlll.configlib; + +import com.google.common.jimfs.Jimfs; +import de.exlll.configlib.configurations.ExampleConfigurationA2; +import de.exlll.configlib.configurations.ExampleConfigurationNulls; +import de.exlll.configlib.configurations.ExampleInitializer; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.awt.Point; +import java.io.IOException; +import java.nio.file.FileSystem; +import java.nio.file.Files; +import java.nio.file.Path; + +import static de.exlll.configlib.configurations.ExampleEqualityAsserter.assertExampleConfigurationsA2Equal; +import static de.exlll.configlib.configurations.ExampleEqualityAsserter.assertExampleConfigurationsNullsEqual; + +final class ExampleConfigurationYamlTests { + private static final ConfigurationProperties PROPERTIES_ALLOW_NULL = ConfigurationProperties.newBuilder() + .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) + .outputNulls(true) + .inputNulls(true) + .build(); + private static final ConfigurationProperties PROPERTIES_DENY_NULL = ConfigurationProperties.newBuilder() + .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) + .outputNulls(false) + .inputNulls(false) + .build(); + + private final FileSystem fs = Jimfs.newFileSystem(); + private final Path yamlFile = fs.getPath("/tmp/config.yml"); + + @BeforeEach + void setUp() throws IOException { + Files.createDirectories(yamlFile.getParent()); + } + + @AfterEach + void tearDown() throws IOException { + fs.close(); + } + + @Test + void yamlStoreSavesAndLoadsExampleConfigurationA2() { + var properties = YamlConfigurationProperties.newBuilder() + .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) + .build(); + var store = new YamlConfigurationStore<>(ExampleConfigurationA2.class, properties); + ExampleConfigurationA2 cfg1 = ExampleInitializer.newExampleConfigurationA2(); + store.save(cfg1, yamlFile); + ExampleConfigurationA2 cfg2 = store.load(yamlFile); + assertExampleConfigurationsA2Equal(cfg1, cfg2); + } + + @Test + void yamlStoreSavesAndLoadsExampleConfigurationNullsWithNullCollectionElements1() { + var properties = YamlConfigurationProperties.newBuilder() + .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) + .outputNulls(true) + .inputNulls(true) + .build(); + var store = new YamlConfigurationStore<>(ExampleConfigurationNulls.class, properties); + ExampleConfigurationNulls cfg1 = ExampleInitializer + .newExampleConfigurationNullsWithNullCollectionElements1(); + store.save(cfg1, yamlFile); + ExampleConfigurationNulls cfg2 = store.load(yamlFile); + assertExampleConfigurationsNullsEqual(cfg1, cfg2); + } + + @Test + void yamlStoreSavesAndLoadsExampleConfigurationNullsWithoutNullCollectionElements1() { + var properties = YamlConfigurationProperties.newBuilder() + .addSerializer(Point.class, TestUtils.POINT_SERIALIZER) + .build(); + var store = new YamlConfigurationStore<>(ExampleConfigurationNulls.class, properties); + ExampleConfigurationNulls cfg1 = ExampleInitializer + .newExampleConfigurationNullsWithoutNullCollectionElements1(); + store.save(cfg1, yamlFile); + ExampleConfigurationNulls cfg2 = store.load(yamlFile); + assertExampleConfigurationsNullsEqual(cfg1, cfg2); + } +} diff --git a/configlib-core/src/test/java/de/exlll/configlib/YamlConfigurationPropertiesTest.java b/configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationPropertiesTest.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/YamlConfigurationPropertiesTest.java rename to configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationPropertiesTest.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/YamlConfigurationStoreTest.java b/configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationStoreTest.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/YamlConfigurationStoreTest.java rename to configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationStoreTest.java diff --git a/configlib-core/src/test/java/de/exlll/configlib/ConfigurationsTest.java b/configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationsTest.java similarity index 83% rename from configlib-core/src/test/java/de/exlll/configlib/ConfigurationsTest.java rename to configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationsTest.java index 709c71d..23e42ab 100644 --- a/configlib-core/src/test/java/de/exlll/configlib/ConfigurationsTest.java +++ b/configlib-yaml/src/test/java/de/exlll/configlib/YamlConfigurationsTest.java @@ -12,7 +12,7 @@ import java.nio.file.Path; import static org.junit.jupiter.api.Assertions.assertEquals; -class ConfigurationsTest { +class YamlConfigurationsTest { private static final FieldFilter includeI = field -> field.getName().equals("i"); private final FileSystem fs = Jimfs.newFileSystem(); private final Path yamlFile = fs.getPath("/tmp/config.yml"); @@ -37,11 +37,11 @@ class ConfigurationsTest { void saveYamlConfiguration1() { Config configuration = new Config(); - Configurations.saveYamlConfiguration(yamlFile, Config.class, configuration); + YamlConfigurations.saveConfiguration(yamlFile, Config.class, configuration); assertEquals("i: 10\nj: 11", TestUtils.readFile(yamlFile)); configuration.i = 20; - Configurations.saveYamlConfiguration(yamlFile, Config.class, configuration); + YamlConfigurations.saveConfiguration(yamlFile, Config.class, configuration); assertEquals("i: 20\nj: 11", TestUtils.readFile(yamlFile)); } @@ -49,7 +49,7 @@ class ConfigurationsTest { void saveYamlConfiguration2() { Config configuration = new Config(); - Configurations.saveYamlConfiguration( + YamlConfigurations.saveConfiguration( yamlFile, Config.class, configuration, builder -> builder.setFieldFilter(includeI) ); @@ -60,7 +60,7 @@ class ConfigurationsTest { void saveYamlConfiguration3() { Config configuration = new Config(); - Configurations.saveYamlConfiguration( + YamlConfigurations.saveConfiguration( yamlFile, Config.class, configuration, YamlConfigurationProperties.newBuilder().setFieldFilter(includeI).build() ); @@ -70,18 +70,18 @@ class ConfigurationsTest { @Test void loadYamlConfiguration1() { writeString("i: 20\nk: 30"); - Config config = Configurations.loadYamlConfiguration(yamlFile, Config.class); + Config config = YamlConfigurations.loadConfiguration(yamlFile, Config.class); assertConfigEquals(config, 20, 11); writeString("i: 20\nj: 30"); - config = Configurations.loadYamlConfiguration(yamlFile, Config.class); + config = YamlConfigurations.loadConfiguration(yamlFile, Config.class); assertConfigEquals(config, 20, 30); } @Test void loadYamlConfiguration2() { writeString("i: 20\nj: 30"); - Config config = Configurations.loadYamlConfiguration( + Config config = YamlConfigurations.loadConfiguration( yamlFile, Config.class, builder -> builder.setFieldFilter(includeI) ); @@ -92,7 +92,7 @@ class ConfigurationsTest { void loadYamlConfiguration3() { writeString("i: 20\nj: 30"); - Config config = Configurations.loadYamlConfiguration( + Config config = YamlConfigurations.loadConfiguration( yamlFile, Config.class, YamlConfigurationProperties.newBuilder().setFieldFilter(includeI).build() ); @@ -102,19 +102,19 @@ class ConfigurationsTest { @Test void updateYamlConfiguration1() { - Config config = Configurations.updateYamlConfiguration(yamlFile, Config.class); + Config config = YamlConfigurations.updateConfiguration(yamlFile, Config.class); assertConfigEquals(config, 10, 11); assertEquals("i: 10\nj: 11", TestUtils.readFile(yamlFile)); writeString("i: 20\nk: 30"); - config = Configurations.updateYamlConfiguration(yamlFile, Config.class); + config = YamlConfigurations.updateConfiguration(yamlFile, Config.class); assertConfigEquals(config, 20, 11); assertEquals("i: 20\nj: 11", TestUtils.readFile(yamlFile)); } @Test void updateYamlConfiguration2() { - Config config = Configurations.updateYamlConfiguration( + Config config = YamlConfigurations.updateConfiguration( yamlFile, Config.class, builder -> builder.setFieldFilter(includeI) ); @@ -124,7 +124,7 @@ class ConfigurationsTest { @Test void updateYamlConfiguration3() { - Config config = Configurations.updateYamlConfiguration( + Config config = YamlConfigurations.updateConfiguration( yamlFile, Config.class, YamlConfigurationProperties.newBuilder().setFieldFilter(includeI).build() ); diff --git a/configlib-core/src/test/java/de/exlll/configlib/YamlFileWriterTest.java b/configlib-yaml/src/test/java/de/exlll/configlib/YamlFileWriterTest.java similarity index 100% rename from configlib-core/src/test/java/de/exlll/configlib/YamlFileWriterTest.java rename to configlib-yaml/src/test/java/de/exlll/configlib/YamlFileWriterTest.java diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c..249e583 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fc..2ec77e5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,101 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..53a6b23 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle.kts b/settings.gradle.kts index a5f4bf0..bfb48b0 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,6 @@ rootProject.name = "configlib" include("configlib-core") +include("configlib-yaml") include("configlib-paper") include("configlib-waterfall") include("configlib-velocity")