Blame view

src/test/java/pl/itcrowd/youtrack/api/rest/CommandTest.java 1.64 KB
bernard authored
1
package pl.itcrowd.youtrack.api.rest;
bernard authored
2 3 4

import junit.framework.Assert;
import org.junit.Test;
bernard authored
5 6
import pl.itcrowd.youtrack.api.Command;
import pl.itcrowd.youtrack.api.defaults.StateValues;
bernard authored
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

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());
    }
}