@Test void testValidateEntityIdIsReservedKeyword() { when(entityType.getId()).thenReturn("logout"); Exception exception = assertThrows( MolgenisValidationException.class, () -> EntityTypeValidator.validateEntityId(entityType)); assertThat(exception.getMessage()) .containsPattern("Name \\[logout\\] is not allowed because it is a reserved keyword."); }
static void validateEntityId(EntityType entityType) { String id = entityType.getId(); if (!id.equals(ATTRIBUTE_META_DATA) && !id.equals(ENTITY_TYPE_META_DATA) && !id.equals(PACKAGE)) { try { NameValidator.validateEntityName(entityType.getId()); } catch (MolgenisDataException e) { throw new MolgenisValidationException(new ConstraintViolation(e.getMessage())); } } }
EntityTypeValidator { static void validateEntityId(EntityType entityType) { String id = entityType.getId(); if (!id.equals(ATTRIBUTE_META_DATA) && !id.equals(ENTITY_TYPE_META_DATA) && !id.equals(PACKAGE)) { try { NameValidator.validateEntityName(entityType.getId()); } catch (MolgenisDataException e) { throw new MolgenisValidationException(new ConstraintViolation(e.getMessage())); } } } }
EntityTypeValidator { static void validateEntityId(EntityType entityType) { String id = entityType.getId(); if (!id.equals(ATTRIBUTE_META_DATA) && !id.equals(ENTITY_TYPE_META_DATA) && !id.equals(PACKAGE)) { try { NameValidator.validateEntityName(entityType.getId()); } catch (MolgenisDataException e) { throw new MolgenisValidationException(new ConstraintViolation(e.getMessage())); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); }
EntityTypeValidator { static void validateEntityId(EntityType entityType) { String id = entityType.getId(); if (!id.equals(ATTRIBUTE_META_DATA) && !id.equals(ENTITY_TYPE_META_DATA) && !id.equals(PACKAGE)) { try { NameValidator.validateEntityName(entityType.getId()); } catch (MolgenisDataException e) { throw new MolgenisValidationException(new ConstraintViolation(e.getMessage())); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType); }
EntityTypeValidator { static void validateEntityId(EntityType entityType) { String id = entityType.getId(); if (!id.equals(ATTRIBUTE_META_DATA) && !id.equals(ENTITY_TYPE_META_DATA) && !id.equals(PACKAGE)) { try { NameValidator.validateEntityName(entityType.getId()); } catch (MolgenisDataException e) { throw new MolgenisValidationException(new ConstraintViolation(e.getMessage())); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType);  }