MetamodelImpl implements Metamodel, MetamodelProvider { @Override public Set<EntityType<?>> getEntities() { return new HashSet<>(entities.values()); } protected  MetamodelImpl();  MetamodelImpl(Configuration configuration); void build(PersistenceUnitClassFinder classFinder); @SuppressWarnings("unchecked") @Override EntityTypeImpl<X> entity(Class<X> cls); @Override Set<EntityType<?>> getEntities(); @Override Set<ManagedType<?>> getManagedTypes(); @Override Set<Class<?>> getInferredClasses(); NamedQueryManager getNamedQueryManager(); ResultSetMappingManager getResultSetMappingManager(); @Override Set<URI> getModuleExtractionExtraSignature(); @Override void addUriToModuleExtractionSignature(URI uri); @Override Metamodel getMetamodel(); @Override boolean isEntityType(Class<?> cls);  }
@Test void throwsExceptionWhenTryingToBuildClassWithoutOWLClassAnnotation() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(String.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }
@Test void throwsExceptionWhenTypesFieldIsNotASet() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(ClassWithInvalidTypes.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }
@Test void throwsExceptionWhenPropertiesIsNotAMap() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(ClassWithInvalidProperties.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }
@Test void throwExceptionWhenForClassWithInvalidIdentifier() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(ClassWithInvalidIdentifier.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }
@Test void throwsExceptionForClassWithoutIdentifier() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(ClassWithoutIdentifier.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }
@Test void throwsExceptionForEntityWithoutNoArgConstructor() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(ClassWithoutNoArgConstructor.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }
@Test void throwsExceptionForEntityWithPersistentArray() { when(classFinderMock.getEntities()).thenReturn(Collections.singleton(ClassWithArrayAttribute.class)); assertThrows(MetamodelInitializationException.class, this::getMetamodel); }