This commit is contained in:
Imbus 2024-04-20 21:36:30 +02:00
parent 5f374c92f4
commit e526b41b3f
2 changed files with 29 additions and 14 deletions

View file

@ -16,17 +16,19 @@ repositories {
}
dependencies {
// Use JUnit Jupiter for testing.
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.skyscreamer:jsonassert:1.5.0")
testImplementation("com.mashape.unirest:unirest-java:1.4.9")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// This dependency is used by the application.
implementation("com.google.guava:guava:32.1.1-jre")
implementation("com.sparkjava:spark-core:2.9.4")
implementation("com.fasterxml.jackson.core:jackson-core:2.17.0")
implementation("com.fasterxml.jackson.core:jackson-databind:2.17.0")
implementation("org.slf4j:slf4j-simple:1.7.30")
implementation("mysql:mysql-connector-java:8.0.19")
implementation("org.xerial:sqlite-jdbc:3.30.1")
}
// Apply a specific Java toolchain to ease working on different environments.
@ -45,3 +47,18 @@ tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
group = "com.krusty"
version = "1.0"
description = "Krusty"
tasks.named<Jar>("jar") {
// Make the JAR executable.
manifest {
attributes(
"Main-Class" to "krusty.ServerMain",
"Implementation-Title" to "KrustyCookiesAPI",
"Implementation-Version" to version
)
}
}

View file

@ -1,6 +1,6 @@
package krusty;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.nio.file.Files;
@ -10,18 +10,16 @@ import java.util.Calendar;
import java.util.Date;
import org.json.JSONException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class KrustyTests {
public static final String BASE_URL = "http://localhost:" + ServerMain.PORT + ServerMain.API_ENTRYPOINT + "/";
@ -166,7 +164,7 @@ public class KrustyTests {
*/
private static ServerMain server;
@BeforeClass
@BeforeAll
public static void startServer() throws InterruptedException {
try {
// Check if rest server is running
@ -186,7 +184,7 @@ public class KrustyTests {
}
}
@AfterClass
@AfterAll
public static void stopServer() {
if (server != null) {
server.stopServer();