use of org.eclipse.che.api.core.ValidationException in project devspaces-images by redhat-developer.
the class OpenShiftEnvironmentFactoryTest method exceptionOnRecipeLoadError.
@Test(expectedExceptions = ValidationException.class)
public void exceptionOnRecipeLoadError() throws Exception {
when(k8sRecipeParser.parse(any(InternalRecipe.class))).thenThrow(new ValidationException("Could not parse recipe"));
osEnvFactory.doCreate(internalRecipe, emptyMap(), emptyList());
}
use of org.eclipse.che.api.core.ValidationException in project devspaces-images by redhat-developer.
the class WorkspaceServiceTest method shouldReturnBadRequestOnInvalidDevfile.
@Test
public void shouldReturnBadRequestOnInvalidDevfile() throws Exception {
final DevfileDto devfileDto = createDevfileDto();
final WorkspaceImpl workspace = createWorkspace(devfileDto);
when(wsManager.createWorkspace(any(Devfile.class), anyString(), any(), any())).thenThrow(new ValidationException("boom"));
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).contentType("application/json").body(devfileDto).when().post(SECURE_PATH + "/workspace/devfile" + "?namespace=test" + "&attribute=factoryId:factory123" + "&attribute=custom:custom:value");
assertEquals(response.getStatusCode(), 400);
String error = unwrapError(response);
assertEquals(error, "boom");
}
Aggregations