<commit_before>package fi.helsinki.cs.tmc.cli.io;

import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;

public class TerminalIoTest {

    Io io = new TerminalIo();
    OutputStream os;

    @Before
    public void setUp() {
        os = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(os);
        System.setOut(ps);
    }

    @Test
    public void printlnWorksRight() {
        io.println("foo");
        assertTrue(os.toString().equals("foo\n"));
    }
}<commit_msg>Add more terminal io tests.<commit_after>package fi.helsinki.cs.tmc.cli.io;

import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;

public class TerminalIoTest {

    Io io = new TerminalIo();
    OutputStream os;

    @Before
    public void setUp() {
        os = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(os);
        System.setOut(ps);
    }

    @Test
    public void printWord() {
        io.print("foo");
        assertTrue(os.toString().equals("foo"));
    }

    @Test
    public void printLineWithNewLine() {
        io.println("foo");
        assertTrue(os.toString().equals("foo\n"));
    }

    @Test
    public void printNull() {
        io.print(null);
        assertTrue(os.toString().equals("null"));
    }

    @Test
    public void printInteger() {
        io.print(5);
        assertTrue(os.toString().equals("5"));
    }
}
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.001224739742804654, 'mean_word_length': 2.8, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7485531', 'n_tokens_mistral': 507, 'n_tokens_neox': 494, 'n_words': 106}