@Test void testValidateBackendInvalid() { when(entityType.getBackend()).thenReturn("BackendName"); when(dataService.getMeta()).thenReturn(metaDataService); when(metaDataService.hasBackend("BackendName")).thenReturn(false); Exception exception = assertThrows( MolgenisValidationException.class, () -> entityTypeValidator.validateBackend(entityType)); assertThat(exception.getMessage()).containsPattern("Unknown backend \\[BackendName\\]"); }
void validateBackend(EntityType entityType) { String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } }
EntityTypeValidator { void validateBackend(EntityType entityType) { String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } } }
EntityTypeValidator { void validateBackend(EntityType entityType) { String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); }
EntityTypeValidator { void validateBackend(EntityType entityType) { String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType); }
EntityTypeValidator { void validateBackend(EntityType entityType) { String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType);  }