parent
f87051cc23
commit
830916f91c
@ -11,6 +11,11 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(libs.configurate.hocon)
|
compileOnly(libs.configurate.hocon)
|
||||||
compileOnly(libs.libby.core)
|
compileOnly(libs.libby.core)
|
||||||
|
|
||||||
|
testImplementation(libs.configurate.hocon)
|
||||||
|
testImplementation(platform("org.junit:junit-bom:5.9.2"))
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
|
testImplementation(libs.assertj)
|
||||||
}
|
}
|
||||||
|
|
||||||
blossom {
|
blossom {
|
||||||
@ -20,3 +25,12 @@ blossom {
|
|||||||
replaceToken("{configurate}", libs.versions.configurate.get())
|
replaceToken("{configurate}", libs.versions.configurate.get())
|
||||||
replaceToken("{geantyref}", libs.versions.geantyref.get())
|
replaceToken("{geantyref}", libs.versions.geantyref.get())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events("passed", "failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 AuthMeVelocity Contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.github._4drian3d.authmevelocity.common;
|
||||||
|
|
||||||
|
import io.github._4drian3d.authmevelocity.common.configuration.ConfigurationContainer;
|
||||||
|
import io.github._4drian3d.authmevelocity.common.configuration.PaperConfiguration;
|
||||||
|
import io.github._4drian3d.authmevelocity.common.configuration.ProxyConfiguration;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class ConfigurationTest {
|
||||||
|
@TempDir
|
||||||
|
Path path;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testProxyConfigurationCreation() {
|
||||||
|
final ConfigurationContainer<ProxyConfiguration> proxyConfiguration =
|
||||||
|
assertDoesNotThrow(
|
||||||
|
() -> ConfigurationContainer.load(path, ProxyConfiguration.class)
|
||||||
|
);
|
||||||
|
|
||||||
|
assertThat(proxyConfiguration)
|
||||||
|
.isNotNull()
|
||||||
|
.extracting(ConfigurationContainer::get)
|
||||||
|
.isNotNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testPaperConfigurationCreation() {
|
||||||
|
final ConfigurationContainer<PaperConfiguration> proxyConfiguration =
|
||||||
|
assertDoesNotThrow(
|
||||||
|
() -> ConfigurationContainer.load(path, PaperConfiguration.class)
|
||||||
|
);
|
||||||
|
|
||||||
|
assertThat(proxyConfiguration)
|
||||||
|
.isNotNull()
|
||||||
|
.extracting(ConfigurationContainer::get)
|
||||||
|
.isNotNull()
|
||||||
|
.extracting(PaperConfiguration::debug)
|
||||||
|
.isEqualTo(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,9 @@ geantyref = "1.3.13"
|
|||||||
indra = "3.0.1"
|
indra = "3.0.1"
|
||||||
runtask = "2.0.1"
|
runtask = "2.0.1"
|
||||||
|
|
||||||
|
# Test versions
|
||||||
|
assertj = "3.24.2"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
adventure = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
adventure = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
||||||
@ -41,6 +44,8 @@ build-indra-common = { module = "net.kyori:indra-common", version.ref = "indra"
|
|||||||
build-indra-spotless = { module = "net.kyori:indra-licenser-spotless", version.ref = "indra" }
|
build-indra-spotless = { module = "net.kyori:indra-licenser-spotless", version.ref = "indra" }
|
||||||
plugin-shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
|
plugin-shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
|
||||||
|
|
||||||
|
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
|
||||||
pluginyml-bukkit = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" }
|
pluginyml-bukkit = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" }
|
||||||
|
@ -29,6 +29,10 @@ dependencies {
|
|||||||
|
|
||||||
implementation(libs.libby.velocity)
|
implementation(libs.libby.velocity)
|
||||||
implementation(libs.bstats.velocity)
|
implementation(libs.bstats.velocity)
|
||||||
|
|
||||||
|
testImplementation(platform("org.junit:junit-bom:5.9.2"))
|
||||||
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
|
testImplementation(libs.assertj)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
@ -49,5 +53,10 @@ tasks {
|
|||||||
runVelocity {
|
runVelocity {
|
||||||
velocityVersion(libs.versions.velocity.get())
|
velocityVersion(libs.versions.velocity.get())
|
||||||
}
|
}
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events("passed", "failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 AuthMeVelocity Contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.github._4drian3d.authmevelocity.velocity;
|
||||||
|
|
||||||
|
import io.github._4drian3d.authmevelocity.velocity.utils.AuthMeUtils;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.CsvSource;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class AuthMeUtilsTest {
|
||||||
|
@ParameterizedTest
|
||||||
|
@CsvSource({
|
||||||
|
"hola a todos, hola",
|
||||||
|
"hello there, hello",
|
||||||
|
"executeforall, executeforall"
|
||||||
|
})
|
||||||
|
void testUtils(String full, String expected) {
|
||||||
|
assertThat(AuthMeUtils.getFirstArgument(full))
|
||||||
|
.isEqualTo(expected);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 AuthMeVelocity Contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.github._4drian3d.authmevelocity.velocity;
|
||||||
|
|
||||||
|
import io.github._4drian3d.authmevelocity.velocity.utils.Pair;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
public class PairTest {
|
||||||
|
@Test
|
||||||
|
void pairTest() {
|
||||||
|
Pair<Object> pair = Pair.of("survival", null);
|
||||||
|
assertThat(pair)
|
||||||
|
.isNotNull()
|
||||||
|
.extracting(Pair::isEmpty)
|
||||||
|
.isEqualTo(true);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user