diff --git a/.gitignore b/.gitignore
index d691f61b..63858ec4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@
*.nar
*.ear
*.zip
+!src/test/**/*.zip
*.tar.gz
*.rar
*.dll
diff --git a/pom.xml b/pom.xml
index 803788b2..9fb221b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -182,7 +182,15 @@
-->
-
+
+
+ maven-surefire-plugin
+ 3.5.1
+
+ false
+
+
+
-
@@ -334,6 +341,17 @@
+
+
+
+ org.junit
+ junit-bom
+ 5.11.3
+ pom
+ import
+
+
+
@@ -341,6 +359,13 @@
io.github.macster110
jpamutils
0.0.59d
+
+
+
+ org.junit.platform
+ junit-platform-surefire-provider
+
+
@@ -1039,5 +1064,11 @@
+
+
+ org.junit.jupiter
+ junit-jupiter
+ test
+
\ No newline at end of file
diff --git a/src/PamController/test/PamControllerTestHelper.java b/src/PamController/test/PamControllerTestHelper.java
deleted file mode 100644
index b1c20b71..00000000
--- a/src/PamController/test/PamControllerTestHelper.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package PamController.test;
-
-public class PamControllerTestHelper {
-}
diff --git a/src/noiseOneBand/test/OneBandControlTest.java b/src/noiseOneBand/test/OneBandControlTest.java
deleted file mode 100644
index 61834e60..00000000
--- a/src/noiseOneBand/test/OneBandControlTest.java
+++ /dev/null
@@ -1,4 +0,0 @@
-import static org.junit.jupiter.api.Assertions.*;
-class OneBandControlTest {
-
-}
\ No newline at end of file
diff --git a/src/test/export/ExportTest.java b/src/test/export/ExportTest.java
index 25678707..fe682ce9 100644
--- a/src/test/export/ExportTest.java
+++ b/src/test/export/ExportTest.java
@@ -1,8 +1,8 @@
package test.export;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-
+import test.helper.PamControllerTestHelper;
+import clickDetector.ClickControl;
+import clickDetector.ClickDetector;
import org.junit.jupiter.api.Test;
import clickDetector.ClickDetection;
@@ -18,14 +18,16 @@ public class ExportTest {
* Test exporting detections to mat files.
*/
@Test
- public void matFileTest() {
-
+ public void matFileTest() throws Exception {
+ PamControllerTestHelper.InitializePamControllerForTesting();
+
System.out.println("Matched template classifier test: match corr");
-
- //create a list of click detections.
- ClickDetection clickDetection = new ClickDetection(0, 0, 0, null, null, 0);
-
-
+
+ //create a list of click detections.
+ ClickControl control = new ClickControl("name");
+ ClickDetector detector = new ClickDetector(control);
+ ClickDetection clickDetection = new ClickDetection(0, 0, 0, detector, null, 0);
+
//now open the mat file and check that we have all the data from these click detections.
}
diff --git a/src/test/helper/PamControllerTestHelper.java b/src/test/helper/PamControllerTestHelper.java
new file mode 100644
index 00000000..f6c404d1
--- /dev/null
+++ b/src/test/helper/PamControllerTestHelper.java
@@ -0,0 +1,29 @@
+package test.helper;
+
+import PamController.PamController;
+import PamController.PamSettingManager;
+import pamguard.GlobalArguments;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Helper to initialize a headless {@link PamController} from unit tests.
+ * This will only initialize the {@link PamController} once; tests are responsible for cleaning
+ * up any changes they make to the configuration.
+ */
+public class PamControllerTestHelper {
+ private static boolean isInitialized = false;
+
+ public static void InitializePamControllerForTesting() throws IOException {
+ if (!isInitialized) {
+ isInitialized = true;
+ File file = File.createTempFile("OneBandControlTest", "psfx");
+ file.deleteOnExit();
+
+ GlobalArguments.setParam(GlobalArguments.BATCHFLAG, "true");
+ PamSettingManager.remote_psf = file.getAbsolutePath();
+ PamController.create(PamController.RUN_NOTHING);
+ }
+ }
+}
diff --git a/src/test/noiseOneBand/OneBandControlTest.java b/src/test/noiseOneBand/OneBandControlTest.java
new file mode 100644
index 00000000..f6e7e8da
--- /dev/null
+++ b/src/test/noiseOneBand/OneBandControlTest.java
@@ -0,0 +1,41 @@
+package test.noiseOneBand;
+
+import PamController.PamController;
+import PamController.soundMedium.GlobalMedium;
+import test.helper.PamControllerTestHelper;
+import noiseOneBand.OneBandControl;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.BeforeAll;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class OneBandControlTest {
+ @BeforeAll
+ public static void setUpBeforeClass() throws Exception {
+ PamControllerTestHelper.InitializePamControllerForTesting();
+ }
+
+ @Test
+ public void MeasurementnameTest() {
+ try {
+ assertEquals(4, OneBandControl.NMEASURES);
+ assertThrows(Exception.class, () -> OneBandControl.getMeasurementName(4));
+
+ PamController.getInstance().getGlobalMediumManager().setCurrentMedium(GlobalMedium.SoundMedium.Water, false);
+ assertEquals("RMS (dB re 1\u00B5Pa)", OneBandControl.getMeasurementName(0));
+ assertEquals("0-Peak (dB re 1\u00B5Pa)", OneBandControl.getMeasurementName(1));
+ assertEquals("Peak-Peak (dB re 1\u00B5Pa)", OneBandControl.getMeasurementName(2));
+ assertEquals("Integrated SEL (dB re 1\u00B5Pa\u00B2s)", OneBandControl.getMeasurementName(3));
+
+ PamController.getInstance().getGlobalMediumManager().setCurrentMedium(GlobalMedium.SoundMedium.Air, false);
+ assertEquals("RMS (dB re 20\u00B5Pa)", OneBandControl.getMeasurementName(0));
+ assertEquals("0-Peak (dB re 20\u00B5Pa)", OneBandControl.getMeasurementName(1));
+ assertEquals("Peak-Peak (dB re 20\u00B5Pa)", OneBandControl.getMeasurementName(2));
+ assertEquals("Integrated SEL (dB re 400\u00B5Pa\u00B2s)", OneBandControl.getMeasurementName(3));
+ } finally {
+ PamController.getInstance().getGlobalMediumManager().setCurrentMedium(GlobalMedium.SoundMedium.Water, false);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/rawDeepLearningClassifier/PamZip/blue_whale_24.zip b/src/test/resources/rawDeepLearningClassifier/PamZip/blue_whale_24.zip
new file mode 100644
index 00000000..1265875f
Binary files /dev/null and b/src/test/resources/rawDeepLearningClassifier/PamZip/blue_whale_24.zip differ