Java 类org.simpleframework.xml.core.ElementException 实例源码

项目:GitHub    文件:SimpleXmlConverterFactoryTest.java   
@Test public void deserializeWrongValue() throws IOException {
  server.enqueue(new MockResponse().setBody("<myObject><foo/><bar/></myObject>"));

  Call<?> call = service.get();
  try {
    call.execute();
    fail();
  } catch (RuntimeException e) {
    assertThat(e.getCause()).isInstanceOf(ElementException.class)
        .hasMessageStartingWith("Element 'foo' does not have a match in class retrofit2.converter.simplexml.MyObject");
  }
}
项目:GitHub    文件:SimpleXmlConverterFactoryTest.java   
@Test public void deserializeWrongValue() throws IOException {
  server.enqueue(new MockResponse().setBody("<myObject><foo/><bar/></myObject>"));

  Call<?> call = service.get();
  try {
    call.execute();
    fail();
  } catch (RuntimeException e) {
    assertThat(e.getCause()).isInstanceOf(ElementException.class)
        .hasMessageStartingWith("Element 'foo' does not have a match in class retrofit2.converter.simplexml.MyObject");
  }
}
项目:simplexml    文件:RedundantOrderTest.java   
public void testRedundantElementOrder() throws Exception {
   ElementEntry entry = new ElementEntry("a", "b", "c");
   Persister persister = new Persister();
   boolean exception = false;

   try {
      validate(entry, persister);
   }catch(ElementException e) {
      e.printStackTrace();
      exception = true;
   }
   assertTrue(exception);
}
项目:simple-xml    文件:RedundantOrderTest.java   
public void testRedundantElementOrder() throws Exception {
   ElementEntry entry = new ElementEntry("a", "b", "c");
   Persister persister = new Persister();
   boolean exception = false;

   try {
      validate(entry, persister);
   }catch(ElementException e) {
      e.printStackTrace();
      exception = true;
   }
   assertTrue(exception);
}