@Test void testValidateLabelIsEmpty() { when(entityType.getId()).thenReturn("entity"); when(entityType.getLabel()).thenReturn(""); Exception exception = assertThrows( MolgenisValidationException.class, () -> EntityTypeValidator.validateEntityLabel(entityType)); assertThat(exception.getMessage()).containsPattern("Label of EntityType \\[entity\\] is empty"); }
static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label != null) { if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } } }
EntityTypeValidator { static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label != null) { if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } } } }
EntityTypeValidator { static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label != null) { if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); }
EntityTypeValidator { static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label != null) { if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType); }
EntityTypeValidator { static void validateEntityLabel(EntityType entityType) { String label = entityType.getLabel(); if (label != null) { if (label.isEmpty()) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] is empty", entityType.getId()))); } else if (label.trim().equals("")) { throw new MolgenisValidationException( new ConstraintViolation( format("Label of EntityType [%s] contains only white space", entityType.getId()))); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType);  }