Add expected exception handling to test
This commit is contained in:
parent
ab3f68f1c2
commit
44c327d1a3
@ -1,14 +1,13 @@
|
||||
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 XStreamJsonHierarchicalTest {
|
||||
|
||||
@ -34,12 +33,12 @@ public class XStreamJsonHierarchicalTest {
|
||||
Assert.assertNotNull(dataJson);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void convertJsonToObject() {
|
||||
customer = SimpleDataGeneration.generateData();
|
||||
dataJson = xstream.toXML(customer);
|
||||
// customer = (Customer) xstream.fromXML(dataJson);
|
||||
// Assert.assertNotNull(customer);
|
||||
customer = (Customer) xstream.fromXML(dataJson);
|
||||
Assert.assertNotNull(customer);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user