use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class PipelineJsonPresentationModelTest method shouldReturnJson.
@Test
public void shouldReturnJson() {
Map<String, Object> json = pipeline.toJson();
new JsonTester(json).shouldContain("{ 'name' : 'connectfour'," + " 'group' : 'group'," + " 'paused' : 'true'," + " 'pauseCause' : 'upgrading uat'," + " 'pauseBy' : 'jez'," + " 'stages' : []," + " 'forcedBuild' : 'true'" + "}");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JobStatusJsonPresentationModelTest method shouldShowBuildStatusForCompleted.
@Test
public void shouldShowBuildStatusForCompleted() throws Exception {
JobInstance instance = JobInstanceMother.completed("test", JobResult.Passed);
JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance, null);
Map json = presenter.toJsonHash();
new JsonTester(json).shouldContain("{ 'name' : 'test'," + " 'current_status' : 'passed' " + "}");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JsonViewTest method testShouldRenderEmptyMap.
@Test
public void testShouldRenderEmptyMap() throws Exception {
JsonView view = new JsonView();
String json = view.renderJson(new LinkedHashMap());
new JsonTester(json).is("{ }");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JsonViewTest method testShouldRenderAllKeyValuePairsFromMap.
@Test
public void testShouldRenderAllKeyValuePairsFromMap() throws Exception {
Map<String, Object> map = new LinkedHashMap<>();
map.put("key1", "value1");
map.put("key2", "value2");
String json = new JsonView().renderJson(map);
new JsonTester(json).is("{ 'key1' : 'value1', 'key2' : 'value2' }");
}
use of com.thoughtworks.go.util.JsonTester in project gocd by gocd.
the class JsonViewTest method testShouldRenderArray.
@Test
public void testShouldRenderArray() throws Exception {
List list = new ArrayList();
Map<String, Object> nestedMap = new LinkedHashMap<>();
nestedMap.put("key1", "value1");
list.add(nestedMap);
list.add("value2");
JsonView view = new JsonView();
String json = view.renderJson(list);
new JsonTester(json).is("[ { 'key1' : 'value1' }, 'value2' ]");
}
Aggregations