<commit_before>package battleships.backend.classhelpers;

import static org.junit.Assert.*;
import game.impl.BoardLocation;

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

import battleships.backend.State;
import battleships.backend.actionhelpers.ResetHelper;

public class DeployBoardHelperTest {
	private State state;
	private DeployBoardHelper dbh;

	@Before
	public void setUp() throws Exception {
		this.dbh = new DeployBoardHelper();
	}

	@Test
	public void checkEmptyLocationsTest() {
		resetState();
		assertEquals("", dbh.checkPieceLocations(new BoardLocation("A1"), new BoardLocation("A2"), state));
	}
	
	@Test
	public void checkOccupiedLocationsTest() {
		resetState();
		dbh.checkPieceLocations(new BoardLocation("A1"), new BoardLocation("A2"), state);
		assertEquals("", dbh.checkPieceLocations(new BoardLocation("A1"), new BoardLocation("A2"), state));
	}

	private void resetState() {
		this.state = new State();
		ResetHelper rh = new ResetHelper(state);
		rh.reset();
	}

}<commit_msg>updated DeployBoardHelperTest<commit_after>package battleships.backend.classhelpers;

import static org.junit.Assert.*;

import java.util.List;

import game.impl.Board;
import game.impl.BoardLocation;
import game.impl.GamePiece;

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

import battleships.backend.Settings;
import battleships.backend.State;
import battleships.backend.actionhelpers.ResetHelper;

public class DeployBoardHelperTest {
	private State state;
	private DeployBoardHelper dbh;

	@Before
	public void setUp() throws Exception {
		this.dbh = new DeployBoardHelper();
	}

	@Test
	public void checkEmptyLocationsTest() {
		resetState();
		assertEquals("", dbh.checkPieceLocations(new BoardLocation("A1"), new BoardLocation("A2"), state));
	}
	
	@Test
	public void checkOccupiedLocationsTest() {
		resetState();
		BoardLocation locationToAlter = getLocationById(state.getBoard(), "A2");
		locationToAlter.setPiece(new GamePiece(Settings.PIECE_SHIP));
		assertEquals("Pieces are overlapping!", dbh.checkPieceLocations(new BoardLocation("A1"), new BoardLocation("A2"), state));
	}

	private void resetState() {
		this.state = new State();
		ResetHelper rh = new ResetHelper(state);
		rh.reset();
	}
	
	private BoardLocation getLocationById(Board board, String id) {
        List<BoardLocation> locations = board.getLocations();
        for (int i = 0; i < locations.size(); i++)
            if (locations.get(i).getId().equals(id))
                return locations.get(i);

        return null;
    }

}
{'fraction_non_alphanumeric': 0.12182539682539682, 'fraction_numerical': 0.004761904761904762, 'mean_word_length': 5.1041162227602905, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '6272741', 'n_tokens_mistral': 809, 'n_tokens_neox': 769, 'n_words': 176}