2019-10-09 16:18:54 +02:00
|
|
|
package commands;
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
2019-10-09 16:35:42 +02:00
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
2019-10-09 16:18:54 +02:00
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2019-10-09 16:35:42 +02:00
|
|
|
import ch.qos.logback.classic.Level;
|
2019-10-09 16:18:54 +02:00
|
|
|
import picocli.CommandLine;
|
|
|
|
import picocli.CommandLine.Command;
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
name = "TestRead",
|
|
|
|
version = "Version 1.0",
|
|
|
|
sortOptions = false,
|
|
|
|
usageHelpWidth = 60,
|
|
|
|
header = "\n ---- Nicely Generated and Corrected Copies ---- \n\n" +
|
|
|
|
" _______ _________________ ________ \n" +
|
|
|
|
" \\ \\ / _____/\\_ ___ \\\\_ ___ \\ \n" +
|
|
|
|
" / | \\/ \\ ___/ \\ \\// \\ \\/ \n" +
|
|
|
|
" / | \\ \\_ \\ \\ \\___\\ \\___ \n" +
|
|
|
|
" \\____|__ /\\______ /\\______ /\\______ / \n" +
|
|
|
|
" \\/ \\/ \\/ \\/ \n" +
|
|
|
|
" \n" ,
|
|
|
|
footer = "\n\n ---- Provided by IUT Info Nice S3T-G4 ---- \n",
|
|
|
|
description = ""
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class TestRead {
|
|
|
|
|
2019-10-09 16:35:42 +02:00
|
|
|
Read read = new Read(System.out);
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
void setUp () {
|
2019-10-09 16:18:54 +02:00
|
|
|
|
2019-10-09 16:35:42 +02:00
|
|
|
read = new Read(System.out);
|
2019-10-09 16:18:54 +02:00
|
|
|
|
|
|
|
CommandLine cmd = new CommandLine (new TestRead())
|
2019-10-09 16:35:42 +02:00
|
|
|
.addSubcommand("-r", read);
|
2019-10-09 16:18:54 +02:00
|
|
|
|
|
|
|
String[] t = {"-r","-v9","-d","pdf","config.txt"};
|
|
|
|
cmd.execute(t);
|
2019-10-09 16:35:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void testCommand() {
|
|
|
|
|
|
|
|
assertFalse(read == null);
|
2019-10-09 16:18:54 +02:00
|
|
|
|
|
|
|
assertEquals("pdf",read.directory_name);
|
2019-10-09 16:35:42 +02:00
|
|
|
assertEquals(false,read.help);
|
2019-10-09 16:18:54 +02:00
|
|
|
assertEquals(9,read.vb_level);
|
|
|
|
assertEquals("config.txt",read.source_path);
|
|
|
|
assertEquals("result.csv",read.result_name);
|
2019-10-09 16:35:42 +02:00
|
|
|
|
|
|
|
assertFalse(read.logger == null);
|
|
|
|
assertEquals(Level.DEBUG.toString(), read.logger.getLevel().toString());
|
2019-10-09 16:18:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|