@Test public void testSafeSetValue() { BaseElementImpl obj = mock(BaseElementImpl.class); EStructuralFeature feature = mock(EStructuralFeature.class); when(feature.getEType()).thenThrow(new UnsupportedOperationException()); Consumer<String> logger = mock(Consumer.class); Bpmn2Marshalling.setLogger(logger); tested.setValue(obj, feature, "Object", 1); verify(logger, times(1)).accept(anyString()); }
public void setValue(EObject object, EStructuralFeature feature, Object value, int position) { try { doSetValue(object, feature, value, position); } catch (UnsupportedOperationException e) { Bpmn2Marshalling.logError("Cannot set the value [" + value + "] for " + "feature [" + feature.getName() + "] into the " + "object [" + object + "]", e); } }
XMLHelper { public void setValue(EObject object, EStructuralFeature feature, Object value, int position) { try { doSetValue(object, feature, value, position); } catch (UnsupportedOperationException e) { Bpmn2Marshalling.logError("Cannot set the value [" + value + "] for " + "feature [" + feature.getName() + "] into the " + "object [" + object + "]", e); } } }
XMLHelper { public void setValue(EObject object, EStructuralFeature feature, Object value, int position) { try { doSetValue(object, feature, value, position); } catch (UnsupportedOperationException e) { Bpmn2Marshalling.logError("Cannot set the value [" + value + "] for " + "feature [" + feature.getName() + "] into the " + "object [" + object + "]", e); } } XMLHelper();  XMLHelper(XMLResource resource); }
XMLHelper { public void setValue(EObject object, EStructuralFeature feature, Object value, int position) { try { doSetValue(object, feature, value, position); } catch (UnsupportedOperationException e) { Bpmn2Marshalling.logError("Cannot set the value [" + value + "] for " + "feature [" + feature.getName() + "] into the " + "object [" + object + "]", e); } } XMLHelper();  XMLHelper(XMLResource resource); void setOptions(Map<?, ?> options); void setNoNamespacePackage(EPackage pkg); EPackage getNoNamespacePackage(); void setXMLMap(XMLMap map); XMLMap getXMLMap(); void setExtendedMetaData(ExtendedMetaData extendedMetaData); ExtendedMetaData getExtendedMetaData(); XMLResource getResource(); void setResource(XMLResource resource); Object getValue(EObject obj, EStructuralFeature f); String getQName(EClass c); void populateNameInfo(NameInfo nameInfo, EClass c); String getQName(EDataType c); void populateNameInfo(NameInfo nameInfo, EDataType eDataType); String getQName(EStructuralFeature feature); void populateNameInfo(NameInfo nameInfo, EStructuralFeature feature); String getPrefix(EPackage ePackage); String getNamespaceURI(String prefix); List<String> getPrefixes(EPackage ePackage); String getName(ENamedElement obj); String getID(EObject obj); String getIDREF(EObject obj); String getHREF(EObject obj); URI deresolve(URI uri); int getFeatureKind(EStructuralFeature feature); EObject createObject(EFactory eFactory, EClassifier type); EClassifier getType(EFactory eFactory, String typeName); @Deprecated EObject createObject(EFactory eFactory, String classXMIName); EStructuralFeature getFeature(EClass eClass, String namespaceURI, String name); EStructuralFeature getFeature(EClass eClass, String namespaceURI, String name, boolean isElement); String getJavaEncoding(String xmlEncoding); String getXMLEncoding(String javaEncoding); EPackage[] packages(); void setValue(EObject object, EStructuralFeature feature, Object value, int position); List<XMIException> setManyReference(ManyReference reference, String location); void setCheckForDuplicates(boolean checkForDuplicates); void setProcessDanglingHREF(String value); DanglingHREFException getDanglingHREFException(); URI resolve(URI relative, URI base); void pushContext(); void popContext(); void popContext(Map<String, EFactory> prefixesToFactories); void addPrefix(String prefix, String uri); String getPrefix(String namespaceURI); Map<String, String> getAnyContentPrefixToURIMapping(); String getURI(String prefix); EMap<String, String> getPrefixToNamespaceMap(); void recordPrefixToURIMapping(); void setPrefixToNamespaceMap(EMap<String, String> prefixToNamespaceMap); void setAnySimpleType(EClass type); String convertToString(EFactory factory, EDataType dataType, Object value); void setMustHavePrefix(boolean mustHavePrefix); }
XMLHelper { public void setValue(EObject object, EStructuralFeature feature, Object value, int position) { try { doSetValue(object, feature, value, position); } catch (UnsupportedOperationException e) { Bpmn2Marshalling.logError("Cannot set the value [" + value + "] for " + "feature [" + feature.getName() + "] into the " + "object [" + object + "]", e); } } XMLHelper();  XMLHelper(XMLResource resource); void setOptions(Map<?, ?> options); void setNoNamespacePackage(EPackage pkg); EPackage getNoNamespacePackage(); void setXMLMap(XMLMap map); XMLMap getXMLMap(); void setExtendedMetaData(ExtendedMetaData extendedMetaData); ExtendedMetaData getExtendedMetaData(); XMLResource getResource(); void setResource(XMLResource resource); Object getValue(EObject obj, EStructuralFeature f); String getQName(EClass c); void populateNameInfo(NameInfo nameInfo, EClass c); String getQName(EDataType c); void populateNameInfo(NameInfo nameInfo, EDataType eDataType); String getQName(EStructuralFeature feature); void populateNameInfo(NameInfo nameInfo, EStructuralFeature feature); String getPrefix(EPackage ePackage); String getNamespaceURI(String prefix); List<String> getPrefixes(EPackage ePackage); String getName(ENamedElement obj); String getID(EObject obj); String getIDREF(EObject obj); String getHREF(EObject obj); URI deresolve(URI uri); int getFeatureKind(EStructuralFeature feature); EObject createObject(EFactory eFactory, EClassifier type); EClassifier getType(EFactory eFactory, String typeName); @Deprecated EObject createObject(EFactory eFactory, String classXMIName); EStructuralFeature getFeature(EClass eClass, String namespaceURI, String name); EStructuralFeature getFeature(EClass eClass, String namespaceURI, String name, boolean isElement); String getJavaEncoding(String xmlEncoding); String getXMLEncoding(String javaEncoding); EPackage[] packages(); void setValue(EObject object, EStructuralFeature feature, Object value, int position); List<XMIException> setManyReference(ManyReference reference, String location); void setCheckForDuplicates(boolean checkForDuplicates); void setProcessDanglingHREF(String value); DanglingHREFException getDanglingHREFException(); URI resolve(URI relative, URI base); void pushContext(); void popContext(); void popContext(Map<String, EFactory> prefixesToFactories); void addPrefix(String prefix, String uri); String getPrefix(String namespaceURI); Map<String, String> getAnyContentPrefixToURIMapping(); String getURI(String prefix); EMap<String, String> getPrefixToNamespaceMap(); void recordPrefixToURIMapping(); void setPrefixToNamespaceMap(EMap<String, String> prefixToNamespaceMap); void setAnySimpleType(EClass type); String convertToString(EFactory factory, EDataType dataType, Object value); void setMustHavePrefix(boolean mustHavePrefix); static final int DATATYPE_SINGLE; static final int DATATYPE_IS_MANY; static final int IS_MANY_ADD; static final int IS_MANY_MOVE; static final int OTHER; }