DeploymentValidator implements ConfigurationValidator<Deployment> { @Override public void validate(CacheElementOperation operation, Deployment config) throws IllegalArgumentException { switch (operation) { case CREATE: validateCreate(config); break; case DELETE: case UPDATE: default: } }  @Override void validate(CacheElementOperation operation, Deployment config);  }
@Test public void validateCreateWithCorrectJarFile() { deployment.setFile(goodJar); assertThatCode(() -> deploymentValidator.validate(CREATE, deployment)) .doesNotThrowAnyException(); }
@Test public void validateCreateWithIncorrectJarFile() { deployment.setFile(noJar); assertThatThrownBy(() -> deploymentValidator.validate(CREATE, deployment)) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("File does not contain valid JAR content:"); }
@Test public void validateUpdateIsNotImplemented() { assertThatCode(() -> deploymentValidator.validate(UPDATE, deployment)) .doesNotThrowAnyException(); }
@Test public void validateDeleteIsNotImplemented() { assertThatCode(() -> deploymentValidator.validate(DELETE, deployment)) .doesNotThrowAnyException(); }