Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
Knerio committed Jun 7, 2024
1 parent a2495d7 commit 75acd68
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 48 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ subprojects {
apply(plugin = "maven-publish")

group = "de.derioo.javautils"
version = "2.2.3"
version = "2.2.4"

repositories {
mavenCentral()
Expand Down
6 changes: 3 additions & 3 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ dependencies {
implementation(platform("org.junit:junit-bom:5.10.2"))
implementation("org.junit.jupiter:junit-jupiter")
implementation("org.assertj:assertj-core:3.26.0")
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
testImplementation("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
implementation("com.github.seeseemelk:MockBukkit-v1.20:3.9.0")

testImplementation("com.github.seeseemelk:MockBukkit-v1.20:3.9.0")
}

tasks {
runServer {
minecraftVersion("1.20.6")
}
test {
dependsOn(runServer)
useJUnitPlatform()
}
named<JavaCompile>("compileJava") {
Expand Down

This file was deleted.

24 changes: 0 additions & 24 deletions paper/src/main/java/de/derioo/javautils/paper/test/Main.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package de.derioo.javautils.paper;

import be.seeseemelk.mockbukkit.MockBukkit;
import be.seeseemelk.mockbukkit.ServerMock;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;

import static de.derioo.javautils.paper.ItemStackUtility.*;
import static org.assertj.core.api.Assertions.*;

public class ItemStackUtilityTest {

private ServerMock server;
@BeforeEach
public void setUp()
{
server = MockBukkit.mock();
}

@AfterEach
public void tearDown()
{
MockBukkit.unmock();
}

@Test
public void testItemStackDecodingAndEncoding() {
ItemStack[] itemStacks = new ItemStack[]{new ItemStack(Material.DIAMOND), new ItemStack(Material.DIRT)};
try {
byte[] bytes = decodeItemStacksToBytes(itemStacks);
assertThat(bytes).isNotNull();
assertThat(encodeItemStacksFromBytes(bytes)).isEqualTo(itemStacks);
assertThat(encodeItemStacksFromBytes(decodeItemStacksToBytes(new ItemStack[]{itemStacks[0]}))).isEqualTo(new ItemStack[]{itemStacks[0]});
} catch (IOException e) {
throw new RuntimeException(e);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
package de.derioo.javautils.paper;

import be.seeseemelk.mockbukkit.MockBukkit;
import be.seeseemelk.mockbukkit.ServerMock;
import org.bukkit.*;
import org.bukkit.inventory.ItemStack;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.*;

import static de.derioo.javautils.paper.ItemStackUtility.decodeItemStacksToBytes;
import static de.derioo.javautils.paper.ItemStackUtility.encodeItemStacksFromBytes;
import static de.derioo.javautils.paper.MaterialUtility.*;
import static org.assertj.core.api.Assertions.assertThat;

public class MaterialUtilityTest {

private ServerMock server;
@BeforeEach
public void setUp()
{
server = MockBukkit.mock();
}

@AfterEach
public void tearDown()
{
MockBukkit.unmock();
}

static Random random = new Random();

@Test
Expand Down

0 comments on commit 75acd68

Please sign in to comment.