CommandTest.java 1.64 KB
package pl.itcrowd.youtrack.api.rest;

import junit.framework.Assert;
import org.junit.Test;
import pl.itcrowd.youtrack.api.Command;
import pl.itcrowd.youtrack.api.defaults.StateValues;

public class CommandTest {

    @Test
    public void assignee()
    {
        Assert.assertEquals("state Fixed assignee Tomek", Command.stateCommand("Fixed").assignee("Tomek").toString());
    }

    @Test
    public void assigneeChaining()
    {
        Assert.assertEquals("assignee Jacek assignee Tomek assignee Bernard",
            Command.assigneeCommand("Jacek").assignee("Tomek").assignee("Bernard").toString());
    }

    @Test
    public void assigneeCommand()
    {
        Assert.assertEquals("assignee Jacek", Command.assigneeCommand("Jacek").toString());
    }

    @Test
    public void state()
    {
        Assert.assertEquals("assignee Tomek state Open", Command.assigneeCommand("Tomek").state("Open").toString());
        Assert.assertEquals("assignee Tomek state To be discussed", Command.assigneeCommand("Tomek").state(StateValues.ToBeDiscussed).toString());
    }

    @Test
    public void stateChaining()
    {
        Assert.assertEquals("state Fixed state Open state Obsolete", Command.stateCommand("Fixed").state("Open").state("Obsolete").toString());
        Assert.assertEquals("state Fixed state Open state Obsolete", Command.stateCommand("Fixed").state(StateValues.Open).state("Obsolete").toString());
    }

    @Test
    public void stateCommand()
    {
        Assert.assertEquals("state Fixed", Command.stateCommand("Fixed").toString());
        Assert.assertEquals("state In Progress", Command.stateCommand(StateValues.InProgress).toString());
    }
}