if (this.skipCTests) {
System.out.println("C tests have been disabled.");
return;
}
Bus bus = new Bus();
bus.setId("some bus");
Label cityBus = new Label();
cityBus.setValue("city");
Label countryBus = new Label();
countryBus.setValue("country");
Label longDistanceBus = new Label();
longDistanceBus.setValue("long-distance");
bus.setId("bus id");
bus.setLabels(Arrays.asList(cityBus, countryBus, longDistanceBus));
Rectangle door = new Rectangle();
door.setColor(Color.BLUE);
door.setWidth(2);
door.setHeight(4);
door.setLineStyle(LineStyle.solid);
bus.setDoor(door);
Rectangle frame = new Rectangle();
frame.setHeight(10);
frame.setWidth(50);
frame.setColor(Color.YELLOW);
frame.setLineStyle(LineStyle.solid);
bus.setFrame(frame);
Circle front = new Circle();
front.setColor(Color.BLUE);
front.setLineStyle(LineStyle.dotted);
front.setRadius(6);
Circle back = new Circle();
back.setColor(Color.BLUE);
back.setLineStyle(LineStyle.dotted);
back.setRadius(7);
bus.setWheels(new Circle[] {front, back});
Rectangle window1 = new Rectangle();
window1.setColor(Color.BLUE);
window1.setWidth(2);
window1.setHeight(2);
window1.setLineStyle(LineStyle.solid);
Rectangle window2 = new Rectangle();
window2.setColor(Color.BLUE);
window2.setWidth(2);
window2.setHeight(2);
window2.setLineStyle(LineStyle.solid);
Rectangle window3 = new Rectangle();
window3.setColor(Color.BLUE);
window3.setWidth(2);
window3.setHeight(2);
window3.setLineStyle(LineStyle.solid);
bus.setWindows(Arrays.asList(window1, window2, window3));
bus.setType(XmlQNameEnumUtil.toQName(BusType.charter));
bus = processThroughXml(bus);
assertEquals("bus id", bus.getId());
door = bus.getDoor();
assertSame(Color.BLUE, door.getColor());
assertEquals(2, door.getWidth());
assertEquals(4, door.getHeight());
assertSame(LineStyle.solid, door.getLineStyle());
frame = bus.getFrame();
assertEquals(10, frame.getHeight());
assertEquals(50, frame.getWidth());
assertSame(Color.YELLOW, frame.getColor());
assertSame(LineStyle.solid, frame.getLineStyle());
Circle[] wheels = bus.getWheels();
assertEquals(2, wheels.length);
assertEquals(6, wheels[0].getRadius());
assertSame(Color.BLUE, wheels[0].getColor());
assertSame(LineStyle.dotted, wheels[0].getLineStyle());
assertEquals(7, wheels[1].getRadius());
assertSame(Color.BLUE, wheels[1].getColor());
assertSame(LineStyle.dotted, wheels[1].getLineStyle());
Rectangle[] windows = bus.getWindows().toArray(new Rectangle[3]);
assertEquals(2, windows[0].getWidth());
assertEquals(2, windows[0].getHeight());
assertEquals(Color.BLUE, windows[0].getColor());
assertEquals(LineStyle.solid, windows[0].getLineStyle());
assertEquals(2, windows[1].getWidth());
assertEquals(2, windows[1].getHeight());
assertEquals(Color.BLUE, windows[1].getColor());
assertEquals(LineStyle.solid, windows[1].getLineStyle());
assertEquals(2, windows[2].getWidth());
assertEquals(2, windows[2].getHeight());
assertEquals(Color.BLUE, windows[2].getColor());
assertEquals(LineStyle.solid, windows[2].getLineStyle());
assertEquals(BusType.charter, XmlQNameEnumUtil.fromQName(bus.getType(), BusType.class));
}