Created
November 13, 2012 10:25
-
-
Save asicfr/4065063 to your computer and use it in GitHub Desktop.
ID et IDREF java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.idref.other; | |
import javax.xml.bind.JAXBContext; | |
import javax.xml.bind.JAXBElement; | |
import javax.xml.bind.JAXBException; | |
import javax.xml.bind.Unmarshaller; | |
import junit.framework.TestCase; | |
public class TestASupprimer extends TestCase { | |
public void test1_idref() throws JAXBException { | |
String packageOfObjectFactory = "com.idref.other"; | |
JAXBContext jc = JAXBContext.newInstance(packageOfObjectFactory); | |
Unmarshaller unmarshaller = jc.createUnmarshaller(); | |
JAXBElement<DeliveryType> unmarshal = (JAXBElement<DeliveryType>) unmarshaller.unmarshal(Files.getFile("", "/otherexemple.xml")); | |
DeliveryType deliveryType = unmarshal.getValue(); | |
assertTrue("la commande pointe bien vers le client toto par reference", | |
((CustomerType) deliveryType.getOrder().get(0).getCustomerRef()).getName().equals("toto")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment