@Test public void testIds() { for (EntityMetadata entity : this.currentMetadata.getEntities().values()) { EntityMetadata parsedEntity = parsedMetadata.getEntities().get(entity.getName()); for (FieldMetadata id : entity.getIds().values()) { Assert.assertNotNull( String.format( "Ids : %s have wrong id in project %s", entity.getName(), this.currentMetadata.getName()), parsedEntity.getIds().get(id.getName())); } Assert.assertEquals( String.format( "Ids : %s has a wrong number of ids in project %s", entity.getName(), this.currentMetadata.getName()), entity.getIds().size(), parsedEntity.getIds().size()); } }
@Test public void testFields() { for (EntityMetadata entity : this.currentMetadata.getEntities().values()) { EntityMetadata parsedEntity = parsedMetadata.getEntities().get(entity.getName()); for (FieldMetadata field : entity.getFields().values()) { FieldMetadata parsedField = parsedEntity.getFields().get(field.getName()); Assert.assertNotNull( String.format( "Fields : %s should have field %s in project %s (have %s)", entity.getName(), field.getName(), this.currentMetadata.getName(), parsedEntity.getFields().values().toString()), parsedField); Assert.assertEquals( String.format( "Fields : %s.%s should have nullable = %s in project %s", entity.getName(), field.getName(), field.isNullable(), this.currentMetadata.getName()), field.isNullable(), parsedField.isNullable()); Assert.assertEquals( String.format( "Fields : %s.%s has a wrong column name in project %s", entity.getName(), field.getName(), this.currentMetadata.getName()), field.getColumnName(), parsedField.getColumnName()); } Assert.assertEquals( String.format( "Fields : %s has a wrong number of fields in project %s", entity.getName(), this.currentMetadata.getName()), entity.getFields().size(), parsedEntity.getFields().size()); } }