SignoutRule testé

This commit is contained in:
Maximilien LEDOUX 2022-02-26 15:20:05 +01:00
parent 2c0d56b304
commit d3361a7679
2 changed files with 15 additions and 1 deletions

View File

@ -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);

View File

@ -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));
}
}