コード例 #1
0
 public DriverEndToEndTestSuite() {
   super(DriverEndToEndTestSuite.class.getName());
   addDriverTest(new BEAStaxDriver());
   addDriverTest(new BinaryStreamDriver());
   addDriverTest(new Dom4JDriver());
   addDriverTest(new DomDriver());
   addDriverTest(new JDomDriver());
   if (JVM.is15()) {
     Class driverType = JVM.loadClassForName("com.thoughtworks.xstream.io.xml.JDom2Driver");
     try {
       addDriverTest((HierarchicalStreamDriver) driverType.newInstance());
     } catch (InstantiationException e) {
       throw new AssertionFailedError("Cannot instantiate " + driverType.getName());
     } catch (IllegalAccessException e) {
       throw new AssertionFailedError(
           "Cannot access default constructor of " + driverType.getName());
     }
   }
   addDriverTest(new KXml2DomDriver());
   addDriverTest(new KXml2Driver());
   addDriverTest(new StaxDriver());
   if (JVM.is16()) {
     Class driverType = JVM.loadClassForName("com.thoughtworks.xstream.io.xml.StandardStaxDriver");
     try {
       addDriverTest((HierarchicalStreamDriver) driverType.newInstance());
     } catch (InstantiationException e) {
       throw new AssertionFailedError("Cannot instantiate " + driverType.getName());
     } catch (IllegalAccessException e) {
       throw new AssertionFailedError(
           "Cannot access default constructor of " + driverType.getName());
     }
   }
   addDriverTest(new WstxDriver());
   addDriverTest(new XomDriver());
   addDriverTest(new Xpp3DomDriver());
   addDriverTest(new Xpp3Driver());
   addDriverTest(new XppDomDriver());
   addDriverTest(new XppDriver());
   if (JVM.is14()) {
     Class driverType =
         JVM.loadClassForName("com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver");
     try {
       addDriverTest((HierarchicalStreamDriver) driverType.newInstance());
     } catch (InstantiationException e) {
       throw new AssertionFailedError("Cannot instantiate " + driverType.getName());
     } catch (IllegalAccessException e) {
       throw new AssertionFailedError(
           "Cannot access default constructor of " + driverType.getName());
     }
   }
 }
コード例 #2
0
  public void testAwtColor() {
    boolean isHeadless =
        Boolean.valueOf(System.getProperty("java.awt.headless", "false")).booleanValue();
    if (!isHeadless || JVM.is15()) {
      Color color = new Color(0, 10, 20, 30);

      String expected =
          ""
              + "<awt-color>\n"
              + "  <red>0</red>\n"
              + "  <green>10</green>\n"
              + "  <blue>20</blue>\n"
              + "  <alpha>30</alpha>\n"
              + "</awt-color>";

      assertBothWays(color, expected);
    }
  }