From cb5cb37bf003c2515e6241ae6e192912272da57a Mon Sep 17 00:00:00 2001 From: Louis Calas Date: Wed, 9 Oct 2019 16:35:42 +0200 Subject: [PATCH] Update tests --- NGCC/src/commands/Read.java | 2 +- NGCC/tests/commands/TestRead.java | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/NGCC/src/commands/Read.java b/NGCC/src/commands/Read.java index 2c6e152..c60f402 100644 --- a/NGCC/src/commands/Read.java +++ b/NGCC/src/commands/Read.java @@ -37,7 +37,7 @@ import ocr.GestionnaireCopies; public class Read implements Callable { - private static Logger logger = LogManager.getLogger(Read.class); + public Logger logger = LogManager.getLogger(Read.class); @Spec Model.CommandSpec spec; diff --git a/NGCC/tests/commands/TestRead.java b/NGCC/tests/commands/TestRead.java index 77833de..1191b69 100644 --- a/NGCC/tests/commands/TestRead.java +++ b/NGCC/tests/commands/TestRead.java @@ -2,8 +2,10 @@ package commands; import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import ch.qos.logback.classic.Level; import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.HelpCommand; @@ -27,24 +29,35 @@ import picocli.CommandLine.HelpCommand; class TestRead { - - @Test - void test() { + Read read = new Read(System.out); + + @BeforeEach + void setUp () { - Read read = new Read(System.out); + read = new Read(System.out); CommandLine cmd = new CommandLine (new TestRead()) - .addSubcommand("-r", read) - .addSubcommand("help", new HelpCommand()); + .addSubcommand("-r", read); String[] t = {"-r","-v9","-d","pdf","config.txt"}; cmd.execute(t); + } + + + @Test + void testCommand() { + + assertFalse(read == null); assertEquals("pdf",read.directory_name); + assertEquals(false,read.help); assertEquals(9,read.vb_level); assertEquals("config.txt",read.source_path); assertEquals("result.csv",read.result_name); + + assertFalse(read.logger == null); + assertEquals(Level.DEBUG.toString(), read.logger.getLevel().toString()); } }