Skip to content

Commit

Permalink
fluent-builder: add failing test for inherited builders
Browse files Browse the repository at this point in the history
  • Loading branch information
flaktack committed Sep 12, 2024
1 parent b3710b5 commit ad02367
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugin/src/test/java/com/kscs/util/test/PluginRunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ public void generateAndCompile(final String subDir, final String... pluginArgs)
compileTestCode(subDir);
}

@Test
public void testGenerateSiri() throws Exception {
generateAndCompile("siri",
inFile("siri.xsd"),
"-Xfluent-builder"
);
}

@Test
public void testGenerateAll() throws Exception {
generateAndCompile("all","-b", inFile("binding-config.xjb"),
Expand Down
42 changes: 42 additions & 0 deletions plugin/src/test/resources/siri.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.siri.org.uk/siri" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.siri.org.uk/siri" elementFormDefault="qualified"
attributeFormDefault="unqualified" version="2.1" id="siri_vehicleMonitoring_service">
<xsd:complexType name="VehicleActivityStructure">
<xsd:sequence>
<xsd:element name="MonitoredVehicleJourney">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="MonitoredVehicleJourneyStructure"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MonitoredVehicleJourneyStructure">
<xsd:sequence>
<xsd:element name="TrainNumbers" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TrainNumberRef" type="TrainNumberRefStructure" maxOccurs="unbounded">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TrainNumberRefStructure">
<xsd:annotation>
<xsd:documentation>Type for reference to a TRAIN NUMBER</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="TrainNumber"/>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="TrainNumber">
<xsd:annotation>
<xsd:documentation>Type for identifier of an TRAIN NUMBER</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:NMTOKEN"/>
</xsd:simpleType>
</xsd:schema>

0 comments on commit ad02367

Please sign in to comment.