Clean up formatting

This commit is contained in:
David Morley
2016-04-11 05:26:50 -05:00
parent 44c327d1a3
commit ce2891ed68
4 changed files with 86 additions and 89 deletions
@@ -1,48 +1,47 @@
package com.baeldung.test;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.baeldung.initializer.SimpleXstreamInitializer;
import com.baeldung.pojo.ContactDetails;
import com.baeldung.pojo.Customer;
import com.baeldung.utility.SimpleDataGeneration;
import com.thoughtworks.xstream.XStream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class XStreamJettisonTest {
private Customer customer = null;
private Customer customer = null;
private String dataJson = null;
private String dataJson = null;
private XStream xstream = null;
private XStream xstream = null;
@Before
public void dataSetup() {
SimpleXstreamInitializer simpleXstreamInitializer = new SimpleXstreamInitializer();
xstream = simpleXstreamInitializer.getXstreamJettisonMappedInstance();
xstream.processAnnotations(Customer.class);
}
@Before
public void dataSetup() {
SimpleXstreamInitializer simpleXstreamInitializer = new SimpleXstreamInitializer();
xstream = simpleXstreamInitializer.getXstreamJettisonMappedInstance();
xstream.processAnnotations(Customer.class);
}
@Test
public void convertObjectToJson() {
customer = SimpleDataGeneration.generateData();
xstream.alias("customer" , Customer.class);
xstream.alias("contactDetails" , ContactDetails.class);
xstream.aliasField("fn" , Customer.class , "firstName");
dataJson = xstream.toXML(customer);
System.out.println(dataJson);
Assert.assertNotNull(dataJson);
}
@Test
public void convertObjectToJson() {
customer = SimpleDataGeneration.generateData();
xstream.alias("customer", Customer.class);
xstream.alias("contactDetails", ContactDetails.class);
xstream.aliasField("fn", Customer.class, "firstName");
dataJson = xstream.toXML(customer);
System.out.println(dataJson);
Assert.assertNotNull(dataJson);
}
@Test
public void convertJsonToObject() {
customer = SimpleDataGeneration.generateData();
dataJson = xstream.toXML(customer);
customer = (Customer) xstream.fromXML(dataJson);
System.out.println(customer);
Assert.assertNotNull(customer);
}
@Test
public void convertJsonToObject() {
customer = SimpleDataGeneration.generateData();
dataJson = xstream.toXML(customer);
customer = (Customer) xstream.fromXML(dataJson);
System.out.println(customer);
Assert.assertNotNull(customer);
}
}