ModelContentToEcoreConverter implements IModelConverter<ModelContent, Model> { private org.eclipse.vorto.core.api.model.datatype.Enum convertEnum(EnumModel model) { EnumBuilder builder = BuilderUtils.newEnum(new ModelId(ModelType.Datatype, model.getId().getName(), model.getId().getNamespace(), model.getId().getVersion())); builder.withCategory(model.getCategory()); builder.withDescription(model.getDescription()); builder.withDisplayName(model.getDisplayName()); builder.withVortolang(model.getVortolang()); for (org.eclipse.vorto.model.EnumLiteral literal : model.getLiterals()) { builder.withLiteral(literal.getName(), literal.getDescription()); } return builder.build(); }  @Override Model convert(ModelContent source, Optional<String> platformKey);  }
@Test public void testConvertEnum() { EnumModel enumModel = EnumModel.Builder(ModelId.fromPrettyFormat("org.eclipse.vorto:Unit:1.0.0")) .literal("celcius", null).literal("kg", null).build(); ModelContentToEcoreConverter converter = new ModelContentToEcoreConverter(); org.eclipse.vorto.core.api.model.datatype.Enum model = (org.eclipse.vorto.core.api.model.datatype.Enum) converter .convert(ModelContent.Builder(enumModel).build(), Optional.empty()); assertEquals(enumModel.getId().getNamespace(), model.getNamespace()); assertEquals(enumModel.getId().getName(), model.getName()); assertEquals(enumModel.getId().getVersion(), model.getVersion()); assertEquals(enumModel.getDescription(), model.getDescription()); assertEquals(enumModel.getDisplayName(), model.getDisplayname()); assertEquals(enumModel.getCategory(), model.getCategory()); assertEquals(2, model.getEnums().size()); }