Update tests
This commit is contained in:
parent
0d2ad849da
commit
cb5cb37bf0
@ -37,7 +37,7 @@ import ocr.GestionnaireCopies;
|
|||||||
|
|
||||||
public class Read implements Callable <Void> {
|
public class Read implements Callable <Void> {
|
||||||
|
|
||||||
private static Logger logger = LogManager.getLogger(Read.class);
|
public Logger logger = LogManager.getLogger(Read.class);
|
||||||
|
|
||||||
@Spec
|
@Spec
|
||||||
Model.CommandSpec spec;
|
Model.CommandSpec spec;
|
||||||
|
@ -2,8 +2,10 @@ package commands;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import ch.qos.logback.classic.Level;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
import picocli.CommandLine.Command;
|
import picocli.CommandLine.Command;
|
||||||
import picocli.CommandLine.HelpCommand;
|
import picocli.CommandLine.HelpCommand;
|
||||||
@ -28,23 +30,34 @@ import picocli.CommandLine.HelpCommand;
|
|||||||
|
|
||||||
class TestRead {
|
class TestRead {
|
||||||
|
|
||||||
|
Read read = new Read(System.out);
|
||||||
|
|
||||||
@Test
|
@BeforeEach
|
||||||
void test() {
|
void setUp () {
|
||||||
|
|
||||||
Read read = new Read(System.out);
|
read = new Read(System.out);
|
||||||
|
|
||||||
CommandLine cmd = new CommandLine (new TestRead())
|
CommandLine cmd = new CommandLine (new TestRead())
|
||||||
.addSubcommand("-r", read)
|
.addSubcommand("-r", read);
|
||||||
.addSubcommand("help", new HelpCommand());
|
|
||||||
|
|
||||||
String[] t = {"-r","-v9","-d","pdf","config.txt"};
|
String[] t = {"-r","-v9","-d","pdf","config.txt"};
|
||||||
cmd.execute(t);
|
cmd.execute(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testCommand() {
|
||||||
|
|
||||||
|
assertFalse(read == null);
|
||||||
|
|
||||||
assertEquals("pdf",read.directory_name);
|
assertEquals("pdf",read.directory_name);
|
||||||
|
assertEquals(false,read.help);
|
||||||
assertEquals(9,read.vb_level);
|
assertEquals(9,read.vb_level);
|
||||||
assertEquals("config.txt",read.source_path);
|
assertEquals("config.txt",read.source_path);
|
||||||
assertEquals("result.csv",read.result_name);
|
assertEquals("result.csv",read.result_name);
|
||||||
|
|
||||||
|
assertFalse(read.logger == null);
|
||||||
|
assertEquals(Level.DEBUG.toString(), read.logger.getLevel().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user