diff --git a/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java b/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java index 051794a..4605a30 100644 --- a/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java +++ b/app/src/main/java/lightcontainer/protocol/ProtocolWriter.java @@ -31,7 +31,7 @@ public abstract class ProtocolWriter { public String execute(String... datas) { // Concatatène le nom de la commande avec les données (trim), avec un espace entre chaque String command = null; - StringJoiner builder = new StringJoiner(" ", this.cmdName, ""); + StringJoiner builder = new StringJoiner(" ", this.cmdName, "\r\n"); for (String data : datas) builder.add(data); diff --git a/app/src/test/java/lightcontainer/protocol/rules/writer/SignoutRuleTest.java b/app/src/test/java/lightcontainer/protocol/rules/writer/SignoutRuleTest.java index ab427ff..31bf799 100644 --- a/app/src/test/java/lightcontainer/protocol/rules/writer/SignoutRuleTest.java +++ b/app/src/test/java/lightcontainer/protocol/rules/writer/SignoutRuleTest.java @@ -1,7 +1,21 @@ package lightcontainer.protocol.rules.writer; +import lightcontainer.protocol.ProtocolWriter; +import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.*; class SignoutRuleTest { + @Test + public void whenRuleIsRightThenReturnCommand() { + //GIVEN + ProtocolWriter protocolWriter = new SignoutRule(); + String[] datas = {}; + + //EXPECT + assertNotNull(protocolWriter.execute(datas)); + assertEquals("SIGNOUT\r\n", protocolWriter.execute(datas)); + } + } \ No newline at end of file