credimi-challenge-permutations/src/test/java/com/fabiosalvini/permutations/PermutationsPrinterTest.java

22 lines
663 B
Java

package com.fabiosalvini.permutations;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class PermutationsPrinterTest {
@Test
public void permutationsFormat() throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try (PermutationsPrinter printer = new PermutationsPrinter(outputStream)) {
printer.accept(new long[]{123, 456, 789});
}
String result = outputStream.toString();
assertEquals("123,456,789" + System.lineSeparator(), result);
}
}