package task;

import com.marvin.exceptions.MarvinException;
import com.marvin.task.TaskState;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class TaskStateTest {

    @Test
    public void fromString() throws MarvinException {
        assertEquals(TaskState.SUCCESS, TaskState.fromString("SUCCESS"));
        assertEquals(TaskState.SUCCESS, TaskState.fromString("success"));
        assertEquals(TaskState.SUCCESS, TaskState.fromString("Success"));
    }

    @Test
    public void stateToString() {
        assertEquals("success", TaskState.SUCCESS.toString());
    }

    @Test
    public void valueOfState() {
        assertEquals("success", TaskState.valueOf("SUCCESS").toString());
    }

    @Test(expected = MarvinException.class)
    public void fromStringThrow() throws MarvinException {
        TaskState.fromString("unknown");
    }
}
