Search in sources :

Example 1 with ErrorCollection

use of com.thoughtworks.go.plugin.access.configrepo.ErrorCollection in project gocd by gocd.

the class CRApprovalTest method shouldAppendPrettyLocationInErrors.

@Test
public void shouldAppendPrettyLocationInErrors() {
    CRApproval a = new CRApproval();
    ErrorCollection errors = new ErrorCollection();
    a.getErrors(errors, "Pipeline abc");
    String fullError = errors.getErrorsAsText();
    assertThat(fullError, contains("Pipeline abc; Approval"));
    assertThat(fullError, contains("Missing field 'type'"));
}
Also used : ErrorCollection(com.thoughtworks.go.plugin.access.configrepo.ErrorCollection) Test(org.junit.Test)

Example 2 with ErrorCollection

use of com.thoughtworks.go.plugin.access.configrepo.ErrorCollection in project gocd by gocd.

the class CRStageTest method shouldCheckErrorsInJobs.

@Test
public void shouldCheckErrorsInJobs() {
    CRStage withNamelessJob = new CRStage("build", new CRJob());
    ErrorCollection errors = new ErrorCollection();
    withNamelessJob.getErrors(errors, "TEST");
    String fullError = errors.getErrorsAsText();
    assertThat(fullError, contains("TEST; Stage (build)"));
    assertThat(fullError, contains("Missing field 'name'"));
}
Also used : ErrorCollection(com.thoughtworks.go.plugin.access.configrepo.ErrorCollection) Test(org.junit.Test)

Example 3 with ErrorCollection

use of com.thoughtworks.go.plugin.access.configrepo.ErrorCollection in project gocd by gocd.

the class CRTabTest method shouldDeserializeFromAPILikeObject.

@Test
public void shouldDeserializeFromAPILikeObject() {
    String json = "{\n" + "      \"name\": \"cobertura\",\n" + "      \"path\": \"target/site/cobertura/index.html\"\n" + "    }";
    CRTab deserializedValue = gson.fromJson(json, CRTab.class);
    assertThat(deserializedValue.getName(), is("cobertura"));
    assertThat(deserializedValue.getPath(), is("target/site/cobertura/index.html"));
    ErrorCollection errors = deserializedValue.getErrors();
    assertTrue(errors.isEmpty());
}
Also used : ErrorCollection(com.thoughtworks.go.plugin.access.configrepo.ErrorCollection) Test(org.junit.Test)

Example 4 with ErrorCollection

use of com.thoughtworks.go.plugin.access.configrepo.ErrorCollection in project gocd by gocd.

the class CRTimerTest method shouldDeserializeFromAPILikeObject.

@Test
public void shouldDeserializeFromAPILikeObject() {
    String json = "{\n" + "    \"spec\": \"0 0 22 ? * MON-FRI\",\n" + "    \"only_on_changes\": true\n" + "  }";
    CRTimer deserializedValue = gson.fromJson(json, CRTimer.class);
    assertThat(deserializedValue.getTimerSpec(), is("0 0 22 ? * MON-FRI"));
    assertThat(deserializedValue.isOnlyOnChanges(), is(true));
    ErrorCollection errors = deserializedValue.getErrors();
    assertTrue(errors.isEmpty());
}
Also used : ErrorCollection(com.thoughtworks.go.plugin.access.configrepo.ErrorCollection) CRTimer(com.thoughtworks.go.plugin.access.configrepo.contract.CRTimer) CRBaseTest(com.thoughtworks.go.plugin.access.configrepo.contract.CRBaseTest) Test(org.junit.Test)

Example 5 with ErrorCollection

use of com.thoughtworks.go.plugin.access.configrepo.ErrorCollection in project gocd by gocd.

the class CRTrackingToolTest method shouldDeserializeFromAPILikeObject.

@Test
public void shouldDeserializeFromAPILikeObject() {
    String json = "{\n" + "    \"link\": \"https://github.com/gocd/api.go.cd/issues/${ID}\",\n" + "    \"regex\": \"##(d+)\"\n" + "  }";
    CRTrackingTool deserializedValue = gson.fromJson(json, CRTrackingTool.class);
    assertThat(deserializedValue.getLink(), is("https://github.com/gocd/api.go.cd/issues/${ID}"));
    assertThat(deserializedValue.getRegex(), is("##(d+)"));
    ErrorCollection errors = deserializedValue.getErrors();
    assertTrue(errors.isEmpty());
}
Also used : ErrorCollection(com.thoughtworks.go.plugin.access.configrepo.ErrorCollection) Test(org.junit.Test)

Aggregations

ErrorCollection (com.thoughtworks.go.plugin.access.configrepo.ErrorCollection)18 Test (org.junit.Test)17 CRGitMaterial (com.thoughtworks.go.plugin.access.configrepo.contract.material.CRGitMaterial)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CRBaseTest (com.thoughtworks.go.plugin.access.configrepo.contract.CRBaseTest)1 CRTimer (com.thoughtworks.go.plugin.access.configrepo.contract.CRTimer)1