package com.mjrichardson.teamCity.buildTriggers.MachineAdded;

import org.testng.Assert;
import org.testng.annotations.Test;

@Test
public class MachineAddedSpecTest {
//    public void can_create_requestor_string_when_version_not_supplied() {
//        MachineAddedSpec sut = new MachineAddedSpec("theurl", "theproject");
//        Assert.assertEquals(sut.getRequestorString(), "Machine of project theproject created on theurl");
//    }

    public void can_create_requestor_string() {
        Machine machine = new Machine("the-machine-id", "the-machine-name");
        MachineAddedSpec sut = new MachineAddedSpec("theurl", machine);
        Assert.assertEquals(sut.getRequestorString(), "Machine the-machine-name added to theurl");
    }

    public void to_string_converts_correctly() {
        String[] environmentIds = new String[2];
        environmentIds[0] = "env-1";
        environmentIds[1] = "env-22";
        String[] roleIds = new String[2];
        roleIds[0] = "role-one";
        roleIds[1] = "role-two";
        Machine machine = new Machine("machine-id", "machine-name", environmentIds, roleIds);
        MachineAddedSpec sut = new MachineAddedSpec("the-url", machine);
        String result = sut.toString();
        Assert.assertEquals(result, "{ url: 'the-url', machineName: 'machine-name', machineId: 'machine-id', environmentIds: 'env-1,env-22', roleIds: 'role-one,role-two' }");
    }
}

@@ -165,280 +165,8 @@
 t %7B%0A
-//    public void can_create_requestor_string_when_version_not_supplied() %7B%0A//        MachineAddedSpec sut = new MachineAddedSpec(%22theurl%22, %22theproject%22);%0A//        Assert.assertEquals(sut.getRequestorString(), %22Machine of project theproject created on theurl%22);%0A//    %7D%0A%0A
     

Remove some commented out code - not required