<commit_before>package com.cmendenhall.tests;

import com.cmendenhall.board.Row;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

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

import static org.junit.Assert.*;
import static com.cmendenhall.TicTacToeSymbols.*;

@RunWith(JUnit4.class)
public class RowTest {

    public Row empty = new Row(_, _, _);
    public Row xxo = new Row(X, X, O);
    public Row ooo = new Row(O, O, O);

    private ByteArrayOutputStream output = new ByteArrayOutputStream();

    @Before
    public void setUp() {
        System.setOut(new PrintStream(output));
    }

    @Test
    public void rowExists() {
        Row newRow = new Row(_);
    }

    @Test
    public void rowsAreCorrectlyCompared() {
        Row sameRow = new Row(X, X, O);
        assertTrue(xxo.equals(sameRow));
    }

    @Test
    public void emptyRowContainsAllZeroes() {
        for (int square : empty.getSquares()) assertEquals(0, square);
    }

    @Test
    public void rowXXOContainsCorrectSquares() {
        int[] expected = {X, X, O};
        assertArrayEquals(expected, xxo.getSquares());
    }

    @Test
    public void emptyRowDoesNotHaveWin() {
        assertFalse(empty.hasWin());
    }

    @Test
    public void rowXXODoesNotHaveWin() {
        assertFalse(xxo.hasWin());
    }

    @Test
    public void rowOOOHasWin() {
        assertTrue(ooo.hasWin());
    }

    @Test
    public void rowOOOWinnerIsO() {
        assertEquals(2, ooo.winner());
    }

    @Test
    public void rowOOOWinnerIsNotX() {
        assertFalse(ooo.winner() == 1);
    }

    @Test
    public void rowXXOHasNoWinner() {
        assertEquals(0, xxo.winner());
    }

    @Test
    public void emptyRowSquaresAreFillable() {
        empty = empty.fillSquare(0, X);
        assertEquals(X, empty.getSquare(0));
    }

    @Test
    public void emptyRowIsNotFull() {
        assertFalse(empty.isFull());
    }

    @Test
    public void rowXXOIsFull() {
        assertTrue(xxo.isFull());
    }

    @Test
    public void emptyRowSumIsZero() {
        assertEquals(0, empty.sum());
    }

    @Test
    public void rowXXOSumIsFour() {
        assertEquals(4, xxo.sum());
    }

    @Test
    public void rowOOOSumIsSix() {
        assertEquals(6, ooo.sum());
    }

    @Test
    public void rowsReturnCorrectStrings() {
        assertEquals(" X | X | O\n", xxo.toString());
        assertEquals(" O | O | O\n", ooo.toString());
        assertEquals(" O |   |  \n", new Row(new int[] { O, _, _ }).toString());
    }

    @Test
    public void squaresReturnCorrectSymbols() {
        assertEquals(xxo.intToSymbol(1), "X");
        assertEquals(xxo.intToSymbol(2), "O");
        assertEquals(xxo.intToSymbol(0), " ");
        assertEquals(xxo.intToSymbol(5), "");
    }

    @After
    public void cleanUp() {
        System.setOut(TicTacToeTestHelper.stdout);
    }
}<commit_msg>Duplicated code: Remove output stream from RowTest<commit_after>package com.cmendenhall.tests;

import com.cmendenhall.board.Row;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

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

import static org.junit.Assert.*;
import static com.cmendenhall.TicTacToeSymbols.*;

@RunWith(JUnit4.class)
public class RowTest {

    public Row empty = new Row(_, _, _);
    public Row xxo = new Row(X, X, O);
    public Row ooo = new Row(O, O, O);

    @Test
    public void rowExists() {
        Row newRow = new Row(_);
    }

    @Test
    public void rowsAreCorrectlyCompared() {
        Row sameRow = new Row(X, X, O);
        assertTrue(xxo.equals(sameRow));
    }

    @Test
    public void emptyRowContainsAllZeroes() {
        for (int square : empty.getSquares()) assertEquals(0, square);
    }

    @Test
    public void rowXXOContainsCorrectSquares() {
        int[] expected = {X, X, O};
        assertArrayEquals(expected, xxo.getSquares());
    }

    @Test
    public void emptyRowDoesNotHaveWin() {
        assertFalse(empty.hasWin());
    }

    @Test
    public void rowXXODoesNotHaveWin() {
        assertFalse(xxo.hasWin());
    }

    @Test
    public void rowOOOHasWin() {
        assertTrue(ooo.hasWin());
    }

    @Test
    public void rowOOOWinnerIsO() {
        assertEquals(2, ooo.winner());
    }

    @Test
    public void rowOOOWinnerIsNotX() {
        assertFalse(ooo.winner() == 1);
    }

    @Test
    public void rowXXOHasNoWinner() {
        assertEquals(0, xxo.winner());
    }

    @Test
    public void emptyRowSquaresAreFillable() {
        empty = empty.fillSquare(0, X);
        assertEquals(X, empty.getSquare(0));
    }

    @Test
    public void emptyRowIsNotFull() {
        assertFalse(empty.isFull());
    }

    @Test
    public void rowXXOIsFull() {
        assertTrue(xxo.isFull());
    }

    @Test
    public void emptyRowSumIsZero() {
        assertEquals(0, empty.sum());
    }

    @Test
    public void rowXXOSumIsFour() {
        assertEquals(4, xxo.sum());
    }

    @Test
    public void rowOOOSumIsSix() {
        assertEquals(6, ooo.sum());
    }

    @Test
    public void rowsReturnCorrectStrings() {
        assertEquals(" X | X | O\n", xxo.toString());
        assertEquals(" O | O | O\n", ooo.toString());
        assertEquals(" O |   |  \n", new Row(new int[] { O, _, _ }).toString());
    }

    @Test
    public void squaresReturnCorrectSymbols() {
        assertEquals(xxo.intToSymbol(1), "X");
        assertEquals(xxo.intToSymbol(2), "O");
        assertEquals(xxo.intToSymbol(0), " ");
        assertEquals(xxo.intToSymbol(5), "");
    }
}
{'fraction_non_alphanumeric': 0.1314046706169397, 'fraction_numerical': 0.005228302544440571, 'mean_word_length': 2.5690298507462686, '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': '1200278', 'n_tokens_mistral': 1925, 'n_tokens_neox': 1854, 'n_words': 400}