<commit_before>package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import guitests.guihandles.TaskCardHandle;
import seedu.cmdo.commons.core.Messages;
import seedu.cmdo.testutil.TestTask;
import seedu.cmdo.testutil.TestUtil;

/*
 * @@author A0141128R
 */

//missing test case where you try to add a task to the blocked slot

public class BlockCommandTest extends ToDoListGuiTest {

    @Test
    public void block() {
        //block a time slot without range
        TestTask[] currentList = td.getTypicalTasks();
        TestTask timeToBlock = td.meeting;
        assertBlockSuccess(timeToBlock, currentList);
        currentList = TestUtil.addTasksToList(currentList, timeToBlock);
        
        //add block a timeslot with date/time range
        timeToBlock = td.businessDeal;
        assertBlockSuccess(timeToBlock, currentList);
        currentList = TestUtil.addTasksToList(currentList, timeToBlock);
        
        //cannot done a block task
        commandBox.runCommand("done 5");
        assertResultMessage(Messages.MESSAGE_CANNOT_DONE);
        
        //invalid detail parameter
        commandBox.runCommand("block 'ppp");
        assertResultMessage(Messages.MESSAGE_ENCAPSULATE_DETAIL_WARNING);
        commandBox.runCommand("block ppp'");
        assertResultMessage(Messages.MESSAGE_ENCAPSULATE_DETAIL_WARNING);
        commandBox.runCommand("block ''");
        assertResultMessage(Messages.MESSAGE_BLANK_DETAIL_WARNING);
        
        //block a time slot in an empty list
        commandBox.runCommand("clear");
        assertBlockSuccess(td.deal);

        //invalid command
        commandBox.runCommand("blocks meeting with OCBC");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertBlockSuccess(TestTask timeToBlock, TestTask... currentList) {
 
        commandBox.runCommand(timeToBlock.getBlockCommand());
<commit_msg>New test case to see if you can add a task to a blocked timeslot<commit_after>package guitests;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

import guitests.guihandles.TaskCardHandle;
import seedu.cmdo.commons.core.Messages;
import seedu.cmdo.testutil.TestTask;
import seedu.cmdo.testutil.TestUtil;

/*
 * @@author A0141128R tested as of 20/10/16
 */

public class BlockCommandTest extends ToDoListGuiTest {

    @Test
    public void block() {
        //block a time slot without range
        TestTask[] currentList = td.getTypicalTasks();
        TestTask timeToBlock = td.meeting;
        assertBlockSuccess(timeToBlock, currentList);
        currentList = TestUtil.addTasksToList(currentList, timeToBlock);
        
        //add block a timeslot with date/time range
        timeToBlock = td.businessDeal;
        assertBlockSuccess(timeToBlock, currentList);
        currentList = TestUtil.addTasksToList(currentList, timeToBlock);
        
        //cannot add task to a blocked timeslot with same timing
        TestTask taskToAdd = td.eat;
        commandBox.runCommand(taskToAdd.getAddCommand());
        assertResultMessage(Messages.MESSAGE_TIMESLOT_BLOCKED);
        commandBox.runCommand("list all");//to go back to general list
        
        //cannot done a block task
        commandBox.runCommand("done 5");
        assertResultMessage(Messages.MESSAGE_CANNOT_DONE);
        
        //invalid detail parameter
        commandBox.runCommand("block 'ppp");
        assertResultMessage(Messages.MESSAGE_ENCAPSULATE_DETAIL_WARNING);
        commandBox.runCommand("block ppp'");
        assertResultMessage(Messages.MESSAGE_ENCAPSULATE_DETAIL_WARNING);
        commandBox.runCommand("block ''");
        assertResultMessage(Messages.MESSAGE_BLANK_DETAIL_WARNING);
        
        //block a time slot in an empty list
        commandBox.runCommand("clear");
        assertBlockSuccess(td.deal);

        //invalid command
        commandBox.runCommand("blocks meeting with OCBC");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertBlockSuccess(TestTask timeToBlock, TestTask... currentList) {
 
        commandBox.runCommand(timeToBlock.getBlockCommand());

{'fraction_non_alphanumeric': 0.08533077660594439, 'fraction_numerical': 0.0052732502396931925, 'mean_word_length': 3.18555667001003, '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': '4323115', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1144, 'n_words': 257}