Search in sources :

Example 1 with CRTimer

use of com.thoughtworks.go.plugin.access.configrepo.contract.CRTimer 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)

Aggregations

ErrorCollection (com.thoughtworks.go.plugin.access.configrepo.ErrorCollection)1 CRBaseTest (com.thoughtworks.go.plugin.access.configrepo.contract.CRBaseTest)1 CRTimer (com.thoughtworks.go.plugin.access.configrepo.contract.CRTimer)1 Test (org.junit.Test)1