-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse NeTEx Resource frame without organisation
- Loading branch information
Showing
2 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/test/java/org/opentripplanner/netex/loader/parser/ResourceFrameParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.opentripplanner.netex.loader.parser; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import jakarta.xml.bind.JAXBElement; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.opentripplanner.netex.index.NetexEntityIndex; | ||
import org.rutebanken.netex.model.Authority; | ||
import org.rutebanken.netex.model.DataManagedObjectStructure; | ||
import org.rutebanken.netex.model.ObjectFactory; | ||
import org.rutebanken.netex.model.ResourceFrame; | ||
|
||
class ResourceFrameParserTest { | ||
|
||
private ResourceFrameParser resourceFrameParser; | ||
private ResourceFrame resourceFrame; | ||
private ObjectFactory objectFactory; | ||
private NetexEntityIndex netexEntityIndex; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
resourceFrameParser = new ResourceFrameParser(); | ||
resourceFrame = new ResourceFrame(); | ||
objectFactory = new ObjectFactory(); | ||
netexEntityIndex = new NetexEntityIndex(); | ||
} | ||
|
||
@Test | ||
void testResourceFrameWithOrganization() { | ||
JAXBElement<? extends DataManagedObjectStructure> organisation = objectFactory.createAuthority( | ||
new Authority() | ||
); | ||
resourceFrame.setOrganisations(objectFactory.createOrganisationsInFrame_RelStructure()); | ||
resourceFrame.getOrganisations().getOrganisation_().add(organisation); | ||
resourceFrameParser.parse(resourceFrame); | ||
resourceFrameParser.setResultOnIndex(netexEntityIndex); | ||
assertEquals(1, netexEntityIndex.authoritiesById.size()); | ||
} | ||
|
||
@Test | ||
void testResourceFrameWithoutOrganization() { | ||
resourceFrameParser.parse(resourceFrame); | ||
resourceFrameParser.setResultOnIndex(netexEntityIndex); | ||
assertEquals(0, netexEntityIndex.authoritiesById.size()); | ||
} | ||
} |