[IMPL] Changed to CLI tool

This commit is contained in:
2020-06-04 00:53:33 +02:00
parent aef1fdf9a5
commit e0a21b5d7c
10 changed files with 43 additions and 461 deletions

View File

@@ -1,3 +0,0 @@
public class MainTest {
}

View File

@@ -1,78 +0,0 @@
package config;
import at.pcgamingfreaks.mkvaudiosubtitlechanger.MKVToolProperties;
import lombok.extern.log4j.Log4j2;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Log4j2
public class MKVToolPropertiesTest {
@Test
public void testPathIsValid() {
try(PrintWriter out = new PrintWriter("mkvDirectoryPath", "UTF-8")){
out.print("src/test/resources");
}catch(FileNotFoundException | UnsupportedEncodingException e){
log.error("File not found!");
}
MKVToolProperties.getInstance().defineMKVToolNixPath();
assertEquals("src/test/resources\\mkvmerge.exe", MKVToolProperties.getInstance().getMkvmergePath());
try(PrintWriter out = new PrintWriter("mkvDirectoryPath", "UTF-8")){
out.print("src/test/resources/");
}catch(FileNotFoundException | UnsupportedEncodingException e){
log.error("File not found!");
}
MKVToolProperties.getInstance().defineMKVToolNixPath();
assertEquals("src/test/resources/mkvmerge.exe", MKVToolProperties.getInstance().getMkvmergePath());
}
@Test
public void testCheckForSeparator() {
try(PrintWriter out = new PrintWriter("mkvDirectoryPath", "UTF-8")){
out.print("src/test/resources");
}catch(FileNotFoundException | UnsupportedEncodingException e){
log.error("File not found!");
}
MKVToolProperties.getInstance().defineMKVToolNixPath();
assertTrue(MKVToolProperties.getInstance().getDirectoryPath().endsWith("/") || MKVToolProperties.getInstance().getDirectoryPath().endsWith("\\"));
try(PrintWriter out = new PrintWriter("mkvDirectoryPath", "UTF-8")){
out.print("src/test/resources/");
}catch(FileNotFoundException | UnsupportedEncodingException e){
log.error("File not found!");
}
MKVToolProperties.getInstance().defineMKVToolNixPath();
assertTrue(MKVToolProperties.getInstance().getDirectoryPath().endsWith("/") || MKVToolProperties.getInstance().getDirectoryPath().endsWith("\\"));
try(PrintWriter out = new PrintWriter("mkvDirectoryPath", "UTF-8")){
out.print("src\\test\\resources");
}catch(FileNotFoundException | UnsupportedEncodingException e){
log.error("File not found!");
}
MKVToolProperties.getInstance().defineMKVToolNixPath();
assertTrue(MKVToolProperties.getInstance().getDirectoryPath().endsWith("/") || MKVToolProperties.getInstance().getDirectoryPath().endsWith("\\"));
try(PrintWriter out = new PrintWriter("mkvDirectoryPath", "UTF-8")){
out.print("src\\test\\resources\\");
}catch(FileNotFoundException | UnsupportedEncodingException e){
log.error("File not found!");
}
MKVToolProperties.getInstance().defineMKVToolNixPath();
assertTrue(MKVToolProperties.getInstance().getDirectoryPath().endsWith("/") || MKVToolProperties.getInstance().getDirectoryPath().endsWith("\\"));
}
@AfterEach
public void afterAll() {
File file = new File("mkvDirectoryPath");
file.delete();
}
}