-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
paper/src/main/java/de/derioo/javautils/paper/test/ItemStackTest.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
paper/src/main/java/de/derioo/javautils/paper/test/Main.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
paper/src/test/java/de/derioo/javautils/paper/ItemStackUtilityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
paper/src/test/java/de/derioo/javautils/paper/MaterialUtilityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters