use of com.paulhammant.buildradiator.radiator.model.CreatedRadiator in project BuildRadiator by BuildRadiator.
the class RadiatorIntegrationTest method radiatorCanBeCreatedWithStepNamesThatAreNotTooLong.
@Test
public void radiatorCanBeCreatedWithStepNamesThatAreNotTooLong() {
app = new TestVersionOfBuildRadiatorApp(null);
startApp();
CreatedRadiator createdRadiator = new CreatedRadiator();
given().params("stepNames", join(",", "short1", "short 2", "short 333")).when().post(CONTRIVED_PATH_FOR_TESTING + "/create").then().statusCode(200).body(captureCreatedRadiator(createdRadiator));
Radiator rad = app.getResultsStore().actualRadiators.values().iterator().next();
assertThat(rad.code, equalTo(createdRadiator.code));
assertThat(rad.secret, equalTo(createdRadiator.secret));
assertThat(rad.stepNames, equalTo(stepNames("short1", "short 2", "short 333")));
}
use of com.paulhammant.buildradiator.radiator.model.CreatedRadiator in project BuildRadiator by BuildRadiator.
the class RadiatorIntegrationTest method radiatorCanBeCreatedAndTransformUnderscoresInStepNames.
@Test
public void radiatorCanBeCreatedAndTransformUnderscoresInStepNames() {
app = new TestVersionOfBuildRadiatorApp(null);
startApp();
CreatedRadiator createdRadiator = new CreatedRadiator();
given().params("stepNames", join(",", "P_P", "Q q", "R-R")).when().post(CONTRIVED_PATH_FOR_TESTING + "/create").then().statusCode(200).body(captureCreatedRadiator(createdRadiator));
Radiator rad = app.getResultsStore().actualRadiators.values().iterator().next();
assertThat(rad.code, equalTo(createdRadiator.code));
assertThat(rad.secret, equalTo(createdRadiator.secret));
assertThat(rad.stepNames, equalTo(stepNames("P P", "Q q", "R-R")));
}
use of com.paulhammant.buildradiator.radiator.model.CreatedRadiator in project BuildRadiator by BuildRadiator.
the class HasNewRadiator method captureCreatedRadiator.
public static BaseMatcher<String> captureCreatedRadiator(CreatedRadiator createdRadiator) {
return new BaseMatcher<String>() {
@Override
public boolean matches(Object o) {
try {
CreatedRadiator cr = new ObjectMapper().readValue((String) o, CreatedRadiator.class);
createdRadiator.code = cr.code;
createdRadiator.secret = cr.secret;
} catch (IOException e) {
System.out.println("Error: Jackson couldn't parse JSON into 'CreatedRadiator' instance: " + o);
return false;
}
return true;
}
@Override
public void describeTo(Description description) {
}
};
}
Aggregations