diff --git a/core/build.gradle b/core/build.gradle
index 303b140..26d2eec 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -1,6 +1,8 @@
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
eclipse.project.name = appName + '-core'
+sourceSets.test.java.srcDirs = [ "src/test/java/" ]
+
dependencies {
api "com.badlogicgames.gdx-controllers:gdx-controllers-core:$gdxControllersVersion"
api "com.badlogicgames.gdx:gdx-ai:$aiVersion"
@@ -17,4 +19,11 @@ dependencies {
api "games.rednblack.miniaudio:miniaudio:$miniaudioVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
+ testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3"
+ testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3"
}
+
+test {
+ useJUnitPlatform {
+ }
+}
\ No newline at end of file
diff --git a/core/nbproject/project.properties b/core/nbproject/project.properties
new file mode 100644
index 0000000..e69de29
diff --git a/core/src/main/java/com/openeggbert/compatibility/FileExtension.java b/core/src/main/java/com/openeggbert/compatibility/FileExtension.java
new file mode 100644
index 0000000..85ebcdf
--- /dev/null
+++ b/core/src/main/java/com/openeggbert/compatibility/FileExtension.java
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// 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
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+package com.openeggbert.compatibility;
+
+/**
+ *
+ * @author robertvokac
+ */
+public class FileExtension {
+ private FileExtension() {
+ //Not meant to be instantiated.
+ }
+ public boolean isOpenEggbertOnly(String fileExtension) {
+ return fileExtension != null && !fileExtension.toLowerCase().equals(BLP);
+ }
+ private static final String BLP = "blp";
+}
diff --git a/core/src/main/java/com/openeggbert/compatibility/FileNameCaseType.java b/core/src/main/java/com/openeggbert/compatibility/FileNameCaseType.java
new file mode 100644
index 0000000..0367f3e
--- /dev/null
+++ b/core/src/main/java/com/openeggbert/compatibility/FileNameCaseType.java
@@ -0,0 +1,131 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// 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
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+package com.openeggbert.compatibility;
+
+import com.openeggbert.entity.common.OpenEggbertException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Stream;
+
+/**
+ *
+ * @author robertvokac
+ */
+public enum FileNameCaseType {
+ UPPERCASE,
+ LOWERCASE,
+ CAPITALIZATION;
+
+ public static String convertToString(String string, FileNameCaseType fileNameCaseType) {
+ if (fileNameCaseType == null) {
+ throw new OpenEggbertException("Argument fileNameCaseType is null, which is forbidden");
+ }
+ if (string == null) {
+ return string;
+ }
+ if (string.isEmpty()) {
+ return string;
+ }
+ switch (fileNameCaseType) {
+ case UPPERCASE:
+ return string.toUpperCase();
+ case LOWERCASE:
+ return string.toLowerCase();
+ case CAPITALIZATION:
+ return Character.toUpperCase(string.charAt(0)) + (string.length() == 1 ? "" : string.substring(1).toLowerCase());
+ default:
+ throw new OpenEggbertException("Unsupported FileNameCaseType: " + fileNameCaseType);
+ }
+
+ }
+
+ public static FileNameCaseType ofString(String string) {
+
+ boolean uppercaseOnly = true;
+ boolean lowercaseOnly = true;
+
+ for (char ch : string.toCharArray()) {
+
+ if (Character.isLetter(ch)) {
+ boolean uppercase = Character.isUpperCase(ch);
+ boolean lowercase = Character.isLowerCase(ch);
+
+ if (uppercase) {
+ lowercaseOnly = false;
+ }
+ if (lowercase) {
+ uppercaseOnly = false;
+ }
+ }
+ }
+ if (uppercaseOnly) {
+ return UPPERCASE;
+ }
+ if (lowercaseOnly) {
+ return LOWERCASE;
+ }
+ if (!uppercaseOnly && !lowercaseOnly) {
+ char firstChar = string.charAt(0);
+ char[] charArray = string.toCharArray();
+ List charList = new ArrayList<>();
+ for (Character ch : charArray) {
+ charList.add(ch);
+ }
+ Stream charStream = charList.stream();
+
+ boolean thereIsNoUppercaseCharacterExcludingTheFirstCharacter
+ = charStream
+ .skip(1)
+ .filter(c -> Character.isLetter(c))
+ .filter(c -> Character.isUpperCase(c))
+ .count() == 0;
+ if ((Character.isLetter(firstChar) ? Character.isUpperCase(firstChar) : true)
+ && thereIsNoUppercaseCharacterExcludingTheFirstCharacter) {
+ return CAPITALIZATION;
+ } else {
+ throw new OpenEggbertException("1Could not find FileNameCaseType from String: " + string);
+ }
+
+ }
+ throw new OpenEggbertException("2Could not find FileNameCaseType from String: " + string);
+
+ }
+
+ public static void sortStringsByFileNameCaseType(List list) {
+ Collections.sort(list,
+ new FileNameCaseTypeStringComparator());
+ }
+
+ static class FileNameCaseTypeStringComparator implements Comparator {
+
+ @Override
+ public int compare(String o1, String o2) {
+ FileNameCaseType t1 = FileNameCaseType.ofString(o1);
+ FileNameCaseType t2 = FileNameCaseType.ofString(o2);
+ int i1 = t1 == UPPERCASE ? 1 : (t1 == LOWERCASE ? 2 : 3);
+ int i2 = t2 == UPPERCASE ? 1 : (t2 == LOWERCASE ? 2 : 3);
+ return Integer.valueOf(i1).compareTo(i2);
+ }
+
+ }
+
+}
diff --git a/core/src/main/java/com/openeggbert/compatibility/ImageFormats.java b/core/src/main/java/com/openeggbert/compatibility/ImageFormat.java
similarity index 82%
rename from core/src/main/java/com/openeggbert/compatibility/ImageFormats.java
rename to core/src/main/java/com/openeggbert/compatibility/ImageFormat.java
index c9c586b..c9fd4c3 100644
--- a/core/src/main/java/com/openeggbert/compatibility/ImageFormats.java
+++ b/core/src/main/java/com/openeggbert/compatibility/ImageFormat.java
@@ -25,21 +25,16 @@ import lombok.Getter;
*
* @author robertvokac
*/
-public enum ImageFormats {
+public enum ImageFormat {
BMP("blp", "bmp"),
PNG("png"),
JPEG("jpeg")
;
@Getter
private String[] fileExtensions;
- @Getter
- private boolean openEggbertOnly;
- ImageFormats(String... fileExtensionsIn) {
- this(true, fileExtensionsIn);
- }
- ImageFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) {
+
+ ImageFormat(String... fileExtensionsIn) {
this.fileExtensions = fileExtensionsIn;
- this.openEggbertOnly = openEggbertOnlyIn;
}
}
diff --git a/core/src/main/java/com/openeggbert/compatibility/MusicFormats.java b/core/src/main/java/com/openeggbert/compatibility/MusicFormat.java
similarity index 81%
rename from core/src/main/java/com/openeggbert/compatibility/MusicFormats.java
rename to core/src/main/java/com/openeggbert/compatibility/MusicFormat.java
index ea12f3d..b9a9c9f 100644
--- a/core/src/main/java/com/openeggbert/compatibility/MusicFormats.java
+++ b/core/src/main/java/com/openeggbert/compatibility/MusicFormat.java
@@ -25,22 +25,16 @@ import lombok.Getter;
*
* @author robertvokac
*/
-public enum MusicFormats {
+public enum MusicFormat {
MIDI("blp", "mid"),
+ WAV("wav"),
MP3("mp3"),
OGG("ogg"),
- WAV("wav")
;
@Getter
private String[] fileExtensions;
- @Getter
- private boolean openEggbertOnly;
- MusicFormats(String... fileExtensionsIn) {
- this(true, fileExtensionsIn);
- }
- MusicFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) {
+ MusicFormat(String... fileExtensionsIn) {
this.fileExtensions = fileExtensionsIn;
- this.openEggbertOnly = openEggbertOnlyIn;
}
}
diff --git a/core/src/main/java/com/openeggbert/compatibility/SoundFormats.java b/core/src/main/java/com/openeggbert/compatibility/SoundFormat.java
similarity index 82%
rename from core/src/main/java/com/openeggbert/compatibility/SoundFormats.java
rename to core/src/main/java/com/openeggbert/compatibility/SoundFormat.java
index a215f48..88f090f 100644
--- a/core/src/main/java/com/openeggbert/compatibility/SoundFormats.java
+++ b/core/src/main/java/com/openeggbert/compatibility/SoundFormat.java
@@ -25,21 +25,15 @@ import lombok.Getter;
*
* @author robertvokac
*/
-public enum SoundFormats {
+public enum SoundFormat {
WAV("blp", "wav"),
MP3("mp3"),
OGG("ogg")
;
@Getter
private String[] fileExtensions;
- @Getter
- private boolean openEggbertOnly;
- SoundFormats(String... fileExtensionsIn) {
- this(true, fileExtensionsIn);
- }
- SoundFormats(boolean openEggbertOnlyIn, String... fileExtensionsIn) {
+ SoundFormat(String... fileExtensionsIn) {
this.fileExtensions = fileExtensionsIn;
- this.openEggbertOnly = openEggbertOnlyIn;
}
}
diff --git a/core/src/main/java/com/openeggbert/entity/common/GameFileType.java b/core/src/main/java/com/openeggbert/entity/common/GameFileType.java
index 6afb723..b13b0a3 100644
--- a/core/src/main/java/com/openeggbert/entity/common/GameFileType.java
+++ b/core/src/main/java/com/openeggbert/entity/common/GameFileType.java
@@ -1,7 +1,23 @@
-/*
- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
- * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
- */
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// 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
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+
package com.openeggbert.entity.common;
/**
@@ -9,5 +25,5 @@ package com.openeggbert.entity.common;
* @author robertvokac
*/
public enum GameFileType {
- CONFIG, WORLD, MUSIC, SOUND, IMAGE8, IMAGE16, IMAGE32;
+ CONFIG, WORLD, DEMO, SAVE, USER_INFO, MUSIC, SOUND, IMAGE8, IMAGE16, IMAGE32;
}
diff --git a/core/src/main/java/com/openeggbert/entity/common/ImageType.java b/core/src/main/java/com/openeggbert/entity/common/ImageType.java
new file mode 100644
index 0000000..d15f286
--- /dev/null
+++ b/core/src/main/java/com/openeggbert/entity/common/ImageType.java
@@ -0,0 +1,31 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// 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
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+package com.openeggbert.entity.common;
+
+
+/**
+ *
+ * @author robertvokac
+ */
+public enum ImageType {
+ SPRITE, SCREEN_BACKGROUND;
+
+}
diff --git a/core/src/main/java/com/openeggbert/main/OpenEggbertGame.java b/core/src/main/java/com/openeggbert/main/OpenEggbertGame.java
index e47e67f..79d9769 100644
--- a/core/src/main/java/com/openeggbert/main/OpenEggbertGame.java
+++ b/core/src/main/java/com/openeggbert/main/OpenEggbertGame.java
@@ -19,6 +19,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.main;
+import com.openeggbert.utils.AssetsTxt;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
diff --git a/core/src/main/java/com/openeggbert/mods/ModType.java b/core/src/main/java/com/openeggbert/mods/ModType.java
index 503440c..0f18f7b 100644
--- a/core/src/main/java/com/openeggbert/mods/ModType.java
+++ b/core/src/main/java/com/openeggbert/mods/ModType.java
@@ -25,5 +25,5 @@ package com.openeggbert.mods;
* @author robertvokac
*/
public enum ModType {
- FULL, LEVEL, SOUND, MUSIC, IMAGE08, IMAGE16, IMAGE24,IMAGE24X2, PARTIAL;
+ FULL, LEVEL, SOUND, MUSIC, IMAGE08, IMAGE16, IMAGE24, IMAGE24X2, TEXT, PARTIAL;
}
diff --git a/core/src/main/java/com/openeggbert/main/AssetsTxt.java b/core/src/main/java/com/openeggbert/utils/AssetsTxt.java
similarity index 99%
rename from core/src/main/java/com/openeggbert/main/AssetsTxt.java
rename to core/src/main/java/com/openeggbert/utils/AssetsTxt.java
index 15ae8aa..96f0cf6 100644
--- a/core/src/main/java/com/openeggbert/main/AssetsTxt.java
+++ b/core/src/main/java/com/openeggbert/utils/AssetsTxt.java
@@ -17,7 +17,7 @@
// or write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
///////////////////////////////////////////////////////////////////////////////////////////////
-package com.openeggbert.main;
+package com.openeggbert.utils;
import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;
diff --git a/core/src/main/java/com/openeggbert/utils/OpenEggbertUtils.java b/core/src/main/java/com/openeggbert/utils/OpenEggbertUtils.java
index 4e539f1..a99f503 100644
--- a/core/src/main/java/com/openeggbert/utils/OpenEggbertUtils.java
+++ b/core/src/main/java/com/openeggbert/utils/OpenEggbertUtils.java
@@ -19,6 +19,13 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.utils;
+import com.openeggbert.compatibility.FileNameCaseType;
+import com.openeggbert.compatibility.ImageFormat;
+import com.openeggbert.compatibility.MusicFormat;
+import com.openeggbert.compatibility.SoundFormat;
+import com.openeggbert.entity.common.GameFileType;
+import com.openeggbert.entity.common.OpenEggbertException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -29,14 +36,83 @@ import java.util.stream.Stream;
* @author robertvokac
*/
public class OpenEggbertUtils {
+
private OpenEggbertUtils() {
//Not meant to be instantiated.
}
+
public static Stream lines(String string) {
return Arrays.asList(string.split("\\r?\\n")).stream();
}
- public static List streamToList(Stream stream) {
+
+ public static List streamToList(Stream stream) {
return stream.collect(Collectors.toList());
}
-
+
+ public static List createPossibleFileNames(GameFileType gameFileType, String fileName) {
+ List list = new ArrayList<>();
+ if (gameFileType.name().startsWith(IMAGE)) {
+ String fileNameWithoutExtension = getFileNameWithoutExtension(fileName);
+
+ for (ImageFormat imageFormat : ImageFormat.values()) {
+ fillListWithPossibleFileNamesForGivenFileExtension(imageFormat.getFileExtensions(), fileNameWithoutExtension, list);
+ }
+ return list;
+ }
+
+ if (gameFileType == GameFileType.MUSIC) {
+ String fileNameWithoutExtension = getFileNameWithoutExtension(fileName);
+
+ for (MusicFormat musicFormat : MusicFormat.values()) {
+ fillListWithPossibleFileNamesForGivenFileExtension(musicFormat.getFileExtensions(), fileNameWithoutExtension, list);
+ }
+ return list;
+ }
+
+ if (gameFileType == GameFileType.SOUND) {
+ String fileNameWithoutExtension = getFileNameWithoutExtension(fileName);
+
+ for (SoundFormat soundFormat : SoundFormat.values()) {
+ fillListWithPossibleFileNamesForGivenFileExtension(soundFormat.getFileExtensions(), fileNameWithoutExtension, list);
+ }
+ return list;
+ }
+ if (
+ gameFileType == GameFileType.CONFIG ||
+ gameFileType == GameFileType.WORLD ||
+ gameFileType == GameFileType.DEMO ||
+ gameFileType == GameFileType.SAVE ||
+ gameFileType == GameFileType.USER_INFO
+ ) {
+ for (FileNameCaseType fileNameCaseType : FileNameCaseType.values()) {
+ list.add(FileNameCaseType.convertToString(fileName, fileNameCaseType));
+ }
+ return list;
+ }
+ throw new OpenEggbertException("Unsupported GameFileType: " + gameFileType);
+ }
+
+ private static void fillListWithPossibleFileNamesForGivenFileExtension(String[] fileExtensions, String fileNameWithoutExtension, List list) {
+ for (String fileExtension : fileExtensions) {
+ String fileNameWithExtension = fileNameWithoutExtension + "." + fileExtension;
+ for (FileNameCaseType fileNameCaseType : FileNameCaseType.values()) {
+ list.add(FileNameCaseType.convertToString(fileNameWithExtension, fileNameCaseType));
+ }
+ }
+ }
+ private static final String IMAGE = "IMAGE";
+
+ public static String getFileNameWithoutExtension(String fileName) {
+ int dotIndex = -1;
+ for (int i = fileName.length() - 1; i >= 0; i--) {
+ char ch = fileName.charAt(i);
+ if (ch == '.') {
+ dotIndex = i;
+ break;
+ }
+ }
+ return dotIndex == -1 ? fileName : fileName.substring(0, dotIndex);
+
+ }
+
}
diff --git a/core/src/test/java/com/openeggbert/compatibility/FileNameCaseTypeTest.java b/core/src/test/java/com/openeggbert/compatibility/FileNameCaseTypeTest.java
new file mode 100644
index 0000000..6dc032e
--- /dev/null
+++ b/core/src/test/java/com/openeggbert/compatibility/FileNameCaseTypeTest.java
@@ -0,0 +1,236 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// 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
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+package com.openeggbert.compatibility;
+
+import com.openeggbert.entity.common.GameFileType;
+import com.openeggbert.entity.common.OpenEggbertException;
+import com.openeggbert.utils.OpenEggbertUtils;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ *
+ * @author robertvokac
+ */
+public class FileNameCaseTypeTest {
+
+ public FileNameCaseTypeTest() {
+ }
+
+ @org.junit.jupiter.api.BeforeAll
+ public static void setUpClass() throws Exception {
+ }
+
+ @org.junit.jupiter.api.AfterAll
+ public static void tearDownClass() throws Exception {
+ }
+
+ @org.junit.jupiter.api.BeforeEach
+ public void setUp() throws Exception {
+ }
+
+ @org.junit.jupiter.api.AfterEach
+ public void tearDown() throws Exception {
+ }
+
+// /**
+// * Test of values method, of class FileNameCaseType.
+// */
+// @org.junit.jupiter.api.Test
+// public void testValues() {
+// System.out.println("values");
+// FileNameCaseType[] expResult = null;
+// FileNameCaseType[] result = FileNameCaseType.values();
+// assertArrayEquals(expResult, result);
+// // TODO review the generated test code and remove the default call to fail.
+// fail("The test case is a prototype.");
+// }
+//
+// /**
+// * Test of valueOf method, of class FileNameCaseType.
+// */
+// @org.junit.jupiter.api.Test
+// public void testValueOf() {
+// System.out.println("valueOf");
+// String name = "";
+// FileNameCaseType expResult = null;
+// FileNameCaseType result = FileNameCaseType.valueOf(name);
+// assertEquals(expResult, result);
+// // TODO review the generated test code and remove the default call to fail.
+// fail("The test case is a prototype.");
+// }
+ /**
+ * Test of ofString method, of class FileNameCaseType.
+ */
+ @org.junit.jupiter.api.Test
+ public void ofStringExpectedReturnedValueIsUPPERCASE() {
+ System.out.println("ofString");
+ String string = "BLUPI000.BLP";
+
+ FileNameCaseType expResult = FileNameCaseType.UPPERCASE;
+ FileNameCaseType result = FileNameCaseType.ofString(string);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of ofString method, of class FileNameCaseType.
+ */
+ @org.junit.jupiter.api.Test
+ public void ofStringExpectedReturnedValueIsLOWERCASE() {
+ System.out.println("ofString");
+ String string = "blupi000.blp";
+
+ FileNameCaseType expResult = FileNameCaseType.LOWERCASE;
+ FileNameCaseType result = FileNameCaseType.ofString(string);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of ofString method, of class FileNameCaseType.
+ */
+ @org.junit.jupiter.api.Test
+ public void ofStringExpectedReturnedValueIsCAPITALIZATION() {
+ System.out.println("ofString");
+ String string = "Blupi000.blp";
+
+ FileNameCaseType expResult = FileNameCaseType.CAPITALIZATION;
+ FileNameCaseType result = FileNameCaseType.ofString(string);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of ofString method, of class FileNameCaseType.
+ */
+ @org.junit.jupiter.api.Test
+ public void ofStringExpectedThrowingException() {
+ String string = "BlupI000.blp";
+ assertThrows(OpenEggbertException.class, () -> {
+ FileNameCaseType.ofString(string);
+ });
+ }
+
+ /**
+ * Test of ofString method, of class FileNameCaseType.
+ */
+ @org.junit.jupiter.api.Test
+ public void ofStringExpectedThrowingException2() {
+ String string = "Blupi000.Blp";
+ assertThrows(OpenEggbertException.class, () -> {
+ FileNameCaseType.ofString(string);
+ });
+ }
+
+ /**
+ * Test of ofString method, of class FileNameCaseType.
+ */
+ @org.junit.jupiter.api.Test
+ public void ofStringExpectedThrowingException3() {
+ String string = "Blupi000.BLP";
+ assertThrows(OpenEggbertException.class, () -> {
+ FileNameCaseType.ofString(string);
+ });
+ }
+
+ /**
+ * Test of convertToString method, of class FileNameCaseType.
+ */
+ @Test
+ public void testConvertToString() {
+ System.out.println("convertToString");
+ String string = "BLUPI000.BLP";
+ FileNameCaseType fileNameCaseType = FileNameCaseType.LOWERCASE;
+ String expResult = "blupi000.blp";
+ String result = FileNameCaseType.convertToString(string, fileNameCaseType);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of convertToString method, of class FileNameCaseType.
+ */
+ @Test
+ public void testConvertToString2() {
+ System.out.println("convertToString");
+ String string = "blupi000.blp";
+ FileNameCaseType fileNameCaseType = FileNameCaseType.UPPERCASE;
+ String expResult = "BLUPI000.BLP";
+ String result = FileNameCaseType.convertToString(string, fileNameCaseType);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of convertToString method, of class FileNameCaseType.
+ */
+ @Test
+ public void testConvertToString3() {
+ System.out.println("convertToString");
+ String string = "blupi000.blp";
+ FileNameCaseType fileNameCaseType = FileNameCaseType.CAPITALIZATION;
+ String expResult = "Blupi000.blp";
+ String result = FileNameCaseType.convertToString(string, fileNameCaseType);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of sortStringsByFileNameCaseType method, of class FileNameCaseType.
+ */
+ @Test
+ public void testSortStringsByFileNameCaseType() {
+ System.out.println("testSortStringsByFileNameCaseType");
+ GameFileType gameFileType = GameFileType.SOUND;
+ String fileName = "BLUPI";
+ String string = "BLUPI.BLP\n"
+ + "blupi.blp\n"
+ + "Blupi.blp\n"
+ + "BLUPI.WAV\n"
+ + "blupi.wav\n"
+ + "Blupi.wav\n"
+ + "BLUPI.MP3\n"
+ + "blupi.mp3\n"
+ + "Blupi.mp3\n"
+ + "BLUPI.OGG\n"
+ + "blupi.ogg\n"
+ + "Blupi.ogg";
+ String expResult = "BLUPI.BLP\n"
+ + "BLUPI.WAV\n"
+ + "BLUPI.MP3\n"
+ + "BLUPI.OGG\n"
+ + "blupi.blp\n"
+ + "blupi.wav\n"
+ + "blupi.mp3\n"
+ + "blupi.ogg\n"
+ + "Blupi.blp\n"
+ + "Blupi.wav\n"
+ + "Blupi.mp3\n"
+ + "Blupi.ogg";
+
+ List list = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName);
+ FileNameCaseType.sortStringsByFileNameCaseType(list);
+ String result = list.stream().collect(Collectors.joining("\n"));
+
+ assertEquals(expResult, result);
+ }
+
+}
diff --git a/core/src/test/java/com/openeggbert/utils/OpenEggbertUtilsTest.java b/core/src/test/java/com/openeggbert/utils/OpenEggbertUtilsTest.java
new file mode 100644
index 0000000..583472e
--- /dev/null
+++ b/core/src/test/java/com/openeggbert/utils/OpenEggbertUtilsTest.java
@@ -0,0 +1,231 @@
+///////////////////////////////////////////////////////////////////////////////////////////////
+// Open Eggbert: Free recreation of the computer game Speedy Eggbert.
+// Copyright (C) 2024 the original author or authors.
+//
+// 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
+// or write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+///////////////////////////////////////////////////////////////////////////////////////////////
+package com.openeggbert.utils;
+
+import com.openeggbert.entity.common.GameFileType;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ *
+ * @author robertvokac
+ */
+public class OpenEggbertUtilsTest {
+
+ public OpenEggbertUtilsTest() {
+ }
+
+ @BeforeAll
+ public static void setUpClass() {
+ }
+
+ @AfterAll
+ public static void tearDownClass() {
+ }
+
+ @BeforeEach
+ public void setUp() {
+ }
+
+ @AfterEach
+ public void tearDown() {
+ }
+
+// /**
+// * Test of lines method, of class OpenEggbertUtils.
+// */
+// @Test
+// public void testLines() {
+// System.out.println("lines");
+// String string = "";
+// Stream expResult = null;
+// Stream result = OpenEggbertUtils.lines(string);
+// assertEquals(expResult, result);
+// // TODO review the generated test code and remove the default call to fail.
+// fail("The test case is a prototype.");
+// }
+//
+// /**
+// * Test of streamToList method, of class OpenEggbertUtils.
+// */
+// @Test
+// public void testStreamToList() {
+// System.out.println("streamToList");
+// List expResult = null;
+// List result = OpenEggbertUtils.streamToList(null);
+// assertEquals(expResult, result);
+// // TODO review the generated test code and remove the default call to fail.
+// fail("The test case is a prototype.");
+// }
+ /**
+ * Test of createPossibleFileNames method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testCreatePossibleFileNamesForImage() {
+ System.out.println("createPossibleFileNames");
+ GameFileType gameFileType = GameFileType.IMAGE8;
+ String fileName = "BLUPI";
+ String expResult = "BLUPI.BLP\n"
+ + "blupi.blp\n"
+ + "Blupi.blp\n"
+ + "BLUPI.BMP\n"
+ + "blupi.bmp\n"
+ + "Blupi.bmp\n"
+ + "BLUPI.PNG\n"
+ + "blupi.png\n"
+ + "Blupi.png\n"
+ + "BLUPI.JPEG\n"
+ + "blupi.jpeg\n"
+ + "Blupi.jpeg";
+ String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
+
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of createPossibleFileNames method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testCreatePossibleFileNamesForMusic() {
+ System.out.println("createPossibleFileNames");
+ GameFileType gameFileType = GameFileType.MUSIC;
+ String fileName = "BLUPI";
+ String expResult = "BLUPI.BLP\n"
+ + "blupi.blp\n"
+ + "Blupi.blp\n"
+ + "BLUPI.MID\n"
+ + "blupi.mid\n"
+ + "Blupi.mid\n"
+ + "BLUPI.WAV\n"
+ + "blupi.wav\n"
+ + "Blupi.wav\n"
+ + "BLUPI.MP3\n"
+ + "blupi.mp3\n"
+ + "Blupi.mp3\n"
+ + "BLUPI.OGG\n"
+ + "blupi.ogg\n"
+ + "Blupi.ogg";
+ String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
+
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of createPossibleFileNames method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testCreatePossibleFileNamesForSound() {
+ System.out.println("createPossibleFileNames");
+ GameFileType gameFileType = GameFileType.SOUND;
+ String fileName = "BLUPI";
+ String expResult = "BLUPI.BLP\n"
+ + "blupi.blp\n"
+ + "Blupi.blp\n"
+ + "BLUPI.WAV\n"
+ + "blupi.wav\n"
+ + "Blupi.wav\n"
+ + "BLUPI.MP3\n"
+ + "blupi.mp3\n"
+ + "Blupi.mp3\n"
+ + "BLUPI.OGG\n"
+ + "blupi.ogg\n"
+ + "Blupi.ogg";
+ String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
+
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of createPossibleFileNames method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testCreatePossibleFileNamesForConfig() {
+ System.out.println("createPossibleFileNames");
+ GameFileType gameFileType = GameFileType.CONFIG;
+ String fileName = "CONFIG.DEF";
+ String expResult = "CONFIG.DEF\n"
+ + "config.def\n"
+ + "Config.def";
+ String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
+
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of createPossibleFileNames method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testCreatePossibleFileNamesForWorld() {
+ System.out.println("createPossibleFileNames");
+ GameFileType gameFileType = GameFileType.WORLD;
+ String fileName = "WORLD031.BLP";
+ String expResult = "WORLD031.BLP\n"
+ + "world031.blp\n"
+ + "World031.blp";
+ String result = OpenEggbertUtils.createPossibleFileNames(gameFileType, fileName).stream().collect(Collectors.joining("\n"));
+
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getFileNameWithoutExtension method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testGetFileNameWithoutExtension() {
+ System.out.println("getFileNameWithoutExtension");
+ String fileName = "BLUPI000.BLP";
+ String expResult = "BLUPI000";
+ String result = OpenEggbertUtils.getFileNameWithoutExtension(fileName);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getFileNameWithoutExtension method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testGetFileNameWithoutExtension2() {
+ System.out.println("getFileNameWithoutExtension");
+ String fileName = "BLUPI000.BLP.PNG";
+ String expResult = "BLUPI000.BLP";
+ String result = OpenEggbertUtils.getFileNameWithoutExtension(fileName);
+ assertEquals(expResult, result);
+ }
+
+ /**
+ * Test of getFileNameWithoutExtension method, of class OpenEggbertUtils.
+ */
+ @Test
+ public void testGetFileNameWithoutExtension3() {
+ System.out.println("getFileNameWithoutExtension");
+ String fileName = "BLUPI000";
+ String expResult = "BLUPI000";
+ String result = OpenEggbertUtils.getFileNameWithoutExtension(fileName);
+ assertEquals(expResult, result);
+ }
+
+
+}
diff --git a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/TestAssetsTxt.java b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/TestAssetsTxt.java
index 73e456f..e5af884 100644
--- a/lwjgl3/src/main/java/com/openeggbert/lwjgl3/TestAssetsTxt.java
+++ b/lwjgl3/src/main/java/com/openeggbert/lwjgl3/TestAssetsTxt.java
@@ -19,7 +19,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////
package com.openeggbert.lwjgl3;
-import com.openeggbert.main.AssetsTxt;
+import com.openeggbert.utils.AssetsTxt;
import java.util.List;
import java.util.Scanner;
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..8dd81e3
--- /dev/null
+++ b/test.sh
@@ -0,0 +1 @@
+./gradlew core:test $1
\ No newline at end of file