-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic tests for MidiHandler, AnalysisPlugin and AudioAnalyser
- Loading branch information
1 parent
6357b0c
commit 1811d13
Showing
5 changed files
with
92 additions
and
8 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
36 changes: 36 additions & 0 deletions
36
src/test/java/org/harmony_analyser/application/services/AudioAnalyserTest.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,36 @@ | ||
package org.harmony_analyser.application.services; | ||
|
||
import org.harmony_analyser.plugins.AnalysisPlugin; | ||
import org.junit.*; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Unit tests for AudioAnalyser class | ||
*/ | ||
|
||
public class AudioAnalyserTest { | ||
private AudioAnalyser audioAnalyser; | ||
private File testWavFile, testReportFixture; | ||
private List<String> inputFiles; | ||
private String resultFile; | ||
|
||
// XXX: Until Mockito is added as dependency and mocks are in practice, expect the fail scenario rather than proper call | ||
|
||
@Before | ||
public void setUp() { | ||
audioAnalyser = new AudioAnalyser(); | ||
inputFiles = new ArrayList<>(); | ||
inputFiles.add("test.wav-chromas.txt"); | ||
inputFiles.add("wrongfile"); | ||
resultFile = "result.txt"; | ||
} | ||
|
||
@Test(expected = AnalysisPlugin.IncorrectInputException.class) | ||
public void shouldRunAnalysis() throws AudioAnalyser.LoadFailedException, AnalysisPlugin.IncorrectInputException, IOException { | ||
audioAnalyser.runAnalysis(inputFiles, resultFile, "harmanal:transition_complexity"); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/java/org/harmony_analyser/application/services/MidiHandlerTest.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,22 @@ | ||
package org.harmony_analyser.application.services; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Unit tests for MidiHandler class | ||
*/ | ||
|
||
public class MidiHandlerTest { | ||
private MidiHandler midiHandler; | ||
|
||
@Before | ||
public void setUp() { | ||
midiHandler = new MidiHandler(); | ||
} | ||
|
||
@Test | ||
public void shouldGetInputDeviceList() { | ||
midiHandler.getInputDeviceList(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/java/org/harmony_analyser/plugins/AnalysisPluginTest.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,27 @@ | ||
package org.harmony_analyser.plugins; | ||
|
||
import org.harmony_analyser.plugins.vamp_plugins.*; | ||
|
||
import org.junit.*; | ||
import java.util.*; | ||
|
||
/** | ||
* Unit tests for AnalysisPlugin class | ||
*/ | ||
|
||
public class AnalysisPluginTest { | ||
private ChordinoPlugin chordino; | ||
private List<String> inputFiles; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
chordino = new ChordinoPlugin(); | ||
inputFiles = new ArrayList<>(); | ||
inputFiles.add("test.mp3"); | ||
} | ||
|
||
@Test(expected = AnalysisPlugin.IncorrectInputException.class) | ||
public void shouldCheckInputFiles() throws AnalysisPlugin.IncorrectInputException { | ||
chordino.checkInputFiles(inputFiles); | ||
} | ||
} |
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