<commit_before>package guitests;

import seedu.tasklist.commons.exceptions.IllegalValueException;
import seedu.tasklist.logic.commands.Command;
import seedu.tasklist.logic.commands.CommandResult;
import seedu.tasklist.logic.commands.DoneCommand;

import static org.junit.Assert.*;

import java.io.IOException;

import org.json.JSONException;
import org.json.simple.parser.ParseException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.tasklist.model.Model;
import seedu.tasklist.model.ModelManager;
import seedu.tasklist.model.task.EndTime;
import seedu.tasklist.model.task.Priority;
import seedu.tasklist.model.task.StartTime;
import seedu.tasklist.model.task.Task;
import seedu.tasklist.model.task.TaskDetails;
import seedu.tasklist.model.task.UniqueTaskList.DuplicateTaskException;

public class DoneCommandTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();
	
	private Model model;
	private String MESSAGE_DONE_TASK_SUCCESS = "Completed Task: %1$s";
	private String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The task index provided is invalid";
	
	
	@Before
	public void initialize() throws DuplicateTaskException, IllegalValueException{
		setup();
	}
	
    public void setup() throws DuplicateTaskException, IllegalValueException {
    	model = new ModelManager();
    	try{
    		model.addTask(new Task(new TaskDetails("test1"), 
            		new StartTime("5pm"), new EndTime("6pm"), new Priority("low")));
            model.addTask(new Task(new TaskDetails("test2"), 
            		new StartTime("3pm"), new EndTime("4pm"), new Priority("med")));
            model.addTask(new Task(new TaskDetails("test3"), 
                    new StartTime("6pm"), new EndTime("8pm"), new Priority("med"), "daily"));
    	}
    	catch (IllegalValueException e){
    		assert false: "Add task will succeed";
    	}
    }
    
    @Test
    public void doneTest1_by_index() throws DuplicateTaskException, IllegalValueException, IOException, JSONException, ParseException{
    	setup();
    	Command doneCommand = new DoneCommand(1);
    	doneCommand.setData(model);
    	CommandResult result = doneCommand.execute();
    	String expectedString = String.format(MESSAGE_DONE_TASK_SUCCESS, model.getTaskList().getTaskList().get(0).getTaskDetails());
    	assertEquals(result.feedbackToUser, expectedString);
    }
/**
    @Test
    public void doneTest2_by_name() throws DuplicateTaskException, IllegalValueException, IOException, JSONException, ParseException {
    	setup();
    	Command doneCommand = new DoneCommand("test2");
    	doneCommand.setData(model);
    	CommandResult result = doneCommand.execute();
    	String expectedString = String.format(MESSAGE_DONE_TASK_SUCCESS, model.getTaskList().getTaskList().get(1).getTaskDetails());
    	assertEquals(result.feedbackToUser, expectedString);
    }
*/    <commit_msg>Fix done command test<commit_after>package guitests;

import seedu.tasklist.commons.exceptions.IllegalValueException;
import seedu.tasklist.logic.commands.Command;
import seedu.tasklist.logic.commands.CommandResult;
import seedu.tasklist.logic.commands.DoneCommand;

import static org.junit.Assert.*;

import java.io.IOException;

import org.json.JSONException;
import org.json.simple.parser.ParseException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.tasklist.model.Model;
import seedu.tasklist.model.ModelManager;
import seedu.tasklist.model.task.EndTime;
import seedu.tasklist.model.task.Priority;
import seedu.tasklist.model.task.StartTime;
import seedu.tasklist.model.task.Task;
import seedu.tasklist.model.task.TaskDetails;
import seedu.tasklist.model.task.UniqueTaskList.DuplicateTaskException;

public class DoneCommandTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();
	
	private Model model;
	private String MESSAGE_DONE_TASK_SUCCESS = "Completed Task: %1$s. Showing all completed tasks now.";
	private String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The task index provided is invalid";
	
	
	@Before
	public void initialize() throws DuplicateTaskException, IllegalValueException{
		setup();
	}
	
    public void setup() throws DuplicateTaskException, IllegalValueException {
    	model = new ModelManager();
    	try{
    		model.addTask(new Task(new TaskDetails("test1"), 
            		new StartTime("5pm"), new EndTime("6pm"), new Priority("low")));
            model.addTask(new Task(new TaskDetails("test2"), 
            		new StartTime("3pm"), new EndTime("4pm"), new Priority("med")));
            model.addTask(new Task(new TaskDetails("test3"), 
                    new StartTime("6pm"), new EndTime("8pm"), new Priority("med"), "daily"));
    	}
    	catch (IllegalValueException e){
    		assert false: "Add task will succeed";
    	}
    }
    
    @Test
    public void doneTest1_by_index() throws DuplicateTaskException, IllegalValueException, IOException, JSONException, ParseException{
    	setup();
    	Command doneCommand = new DoneCommand(1);
    	doneCommand.setData(model);
    	CommandResult result = doneCommand.execute();
    	String expectedString = String.format(MESSAGE_DONE_TASK_SUCCESS, model.getTaskList().getTaskList().get(0).getTaskDetails());
    	assertEquals(result.feedbackToUser, expectedString);
    }

    @Test
    public void doneTest2_by_name() throws DuplicateTaskException, IllegalValueException, IOException, JSONException, ParseException {
    	setup();
    	Command doneCommand = new DoneCommand("test1");
    	doneCommand.setData(model);
    	CommandResult result = doneCommand.execute();
    	String expectedString = String.format(MESSAGE_DONE_TASK_SUCCESS, model.getTaskList().getTaskList().get(1).getTaskDetails());
    	assertEquals(result.feedbackToUser, expectedString);
    }
   
{'fraction_non_alphanumeric': 0.10822290180088345, 'fraction_numerical': 0.0054366292898402994, 'mean_word_length': 4.55377358490566, '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': '1550806', 'n_tokens_mistral': 1743, 'n_tokens_neox': 1697, 'n_words': 356}