From a5c3de8fe779cdc407bc1ba28e7c2d9ba590772d Mon Sep 17 00:00:00 2001 From: Vincent Paturet <46598384+vpaturet@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:18:57 +0100 Subject: [PATCH] Code clean-up (#595) --- pom.xml | 2 +- .../antu/netexdata/NetexDataResource.java | 1 - .../collectors/LineInfoCollector.java | 8 +- .../StopPointsInVehicleJourneyContext.java | 1 - .../InvalidServiceAlterationValidator.java | 12 +-- .../MissingReplacementValidator.java | 14 ++-- .../support/ServiceAlterationUtils.java | 42 +--------- .../support/JourneyPatternUtils.java | 3 +- ...ent.java => NetexEntitiesTestFactory.java} | 48 ++++------- .../InvalidFlexibleAreaValidatorTest.java | 12 +-- ...ectedInterchangeDistanceValidatorTest.java | 4 +- .../DuplicateInterchangesValidatorTest.java | 20 ++--- .../MandatoryFieldsValidatorTest.java | 82 ++++++++++--------- ...opPointsInVehicleJourneyValidatorTest.java | 6 +- ...istanceBetweenStopPointsValidatorTest.java | 10 +-- .../IdenticalStopPointsValidatorTest.java | 10 +-- .../samequayref/SameQuayRefValidatorTest.java | 8 +- .../SameStopPointsValidatorTest.java | 20 ++--- .../StopPointsCountValidatorTest.java | 6 +- ...gPassengerStopAssignmentValidatorTest.java | 22 ++--- ...ingTimetabledPassingTimeValidatorTest.java | 30 +++---- ...InvalidServiceAlterationValidatorTest.java | 16 ++-- .../MissingReplacementValidatorTest.java | 10 +-- .../speed/UnexpectedSpeedValidatorTest.java | 14 ++-- ...tedDistanceInServiceLinkValidatorTest.java | 8 +- .../MismatchedStopPointsValidatorTest.java | 22 ++--- 26 files changed, 186 insertions(+), 245 deletions(-) rename src/test/java/no/entur/antu/netextestdata/{NetexTestFragment.java => NetexEntitiesTestFactory.java} (98%) diff --git a/pom.xml b/pom.xml index bcd00d93..64194d7c 100644 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ false 4.4.4 3.0 - 4.2.0 + 4.3.0 3.1.29 2.11.0 1.17 diff --git a/src/main/java/no/entur/antu/netexdata/NetexDataResource.java b/src/main/java/no/entur/antu/netexdata/NetexDataResource.java index e5cf7110..b84337fc 100644 --- a/src/main/java/no/entur/antu/netexdata/NetexDataResource.java +++ b/src/main/java/no/entur/antu/netexdata/NetexDataResource.java @@ -8,7 +8,6 @@ import no.entur.antu.exception.AntuException; import org.entur.netex.NetexParser; import org.entur.netex.index.api.NetexEntitiesIndex; -import org.entur.netex.validation.validator.jaxb.JAXBValidationContext; import org.entur.netex.validation.validator.model.FromToScheduledStopPointId; import org.entur.netex.validation.validator.model.ServiceLinkId; import org.rutebanken.netex.model.PassengerStopAssignment; diff --git a/src/main/java/no/entur/antu/netexdata/collectors/LineInfoCollector.java b/src/main/java/no/entur/antu/netexdata/collectors/LineInfoCollector.java index 32f3196b..1719feb9 100644 --- a/src/main/java/no/entur/antu/netexdata/collectors/LineInfoCollector.java +++ b/src/main/java/no/entur/antu/netexdata/collectors/LineInfoCollector.java @@ -62,17 +62,13 @@ public void addLineName(String validationReportId, SimpleLine lineInfo) { private SimpleLine lineInfo(JAXBValidationContext validationContext) { return validationContext - .getNetexEntitiesIndex() - .getLineIndex() - .getAll() + .lines() .stream() .findFirst() .map(line -> SimpleLine.of(line, validationContext.getFileName())) .orElse( validationContext - .getNetexEntitiesIndex() - .getFlexibleLineIndex() - .getAll() + .flexibleLines() .stream() .filter(FlexibleLineUtils::isFixedFlexibleLine) .findFirst() diff --git a/src/main/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyContext.java b/src/main/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyContext.java index 28090638..793affc6 100644 --- a/src/main/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyContext.java +++ b/src/main/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyContext.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import no.entur.antu.netexdata.DefaultNetexDataRepository; import org.entur.netex.validation.validator.jaxb.NetexDataRepository; import org.entur.netex.validation.validator.model.ServiceJourneyId; import org.entur.netex.validation.validator.model.ServiceJourneyInterchangeInfo; diff --git a/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidator.java b/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidator.java index ba001680..81a2c835 100644 --- a/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidator.java +++ b/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidator.java @@ -1,5 +1,6 @@ package no.entur.antu.validation.validator.servicejourney.servicealteration; +import java.util.Objects; import no.entur.antu.validation.AntuNetexValidator; import no.entur.antu.validation.RuleCode; import no.entur.antu.validation.validator.servicejourney.servicealteration.support.ServiceAlterationUtils; @@ -32,15 +33,10 @@ protected void validateLineFile( ) { // Validate that those DSJs that got replaced have the 'replaced' service alteration. ServiceAlterationUtils - .datedServiceJourneysWithReferenceToReplaced(validationContext) + .datedServiceJourneysWithReferenceToOriginal(validationContext) .stream() - .map(ServiceAlterationUtils::datedServiceJourneyRef) - .map(datedServiceJourneyRefStructure -> - ServiceAlterationUtils.datedServiceJourney( - datedServiceJourneyRefStructure, - validationContext.getNetexEntitiesIndex() - ) - ) + .map(validationContext::originalDatedServiceJourney) + .filter(Objects::nonNull) .filter(dsj -> dsj.getServiceAlteration() != ServiceAlterationEnumeration.REPLACED ) diff --git a/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidator.java b/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidator.java index d4398fb2..69c3cd11 100644 --- a/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidator.java +++ b/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidator.java @@ -8,7 +8,8 @@ import org.entur.netex.validation.validator.ValidationReport; import org.entur.netex.validation.validator.ValidationReportEntryFactory; import org.entur.netex.validation.validator.jaxb.JAXBValidationContext; -import org.rutebanken.netex.model.VersionOfObjectRefStructure; +import org.entur.netex.validation.validator.jaxb.support.DatedServiceJourneyUtils; +import org.rutebanken.netex.model.ServiceAlterationEnumeration; /** * Validates that the replacement for the service alteration exists. @@ -34,15 +35,16 @@ protected void validateLineFile( ) { List datedServiceJourneyRefsToReplacedDatedServiceJourneys = ServiceAlterationUtils - .datedServiceJourneysWithReferenceToReplaced(validationContext) + .datedServiceJourneysWithReferenceToOriginal(validationContext) .stream() - .map(ServiceAlterationUtils::datedServiceJourneyRef) - .map(VersionOfObjectRefStructure::getRef) + .map(DatedServiceJourneyUtils::originalDatedServiceJourneyRef) .toList(); // Validate that those DSJs that got replaced have a replacement. - ServiceAlterationUtils - .replacedDatedServiceJourneys(validationContext) + validationContext + .datedServiceJourneysByServiceAlteration( + ServiceAlterationEnumeration.REPLACED + ) .stream() .filter( Predicate.not(dsj -> diff --git a/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/support/ServiceAlterationUtils.java b/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/support/ServiceAlterationUtils.java index 5cc7a26a..4a451c01 100644 --- a/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/support/ServiceAlterationUtils.java +++ b/src/main/java/no/entur/antu/validation/validator/servicejourney/servicealteration/support/ServiceAlterationUtils.java @@ -2,37 +2,20 @@ import jakarta.xml.bind.JAXBElement; import java.util.Collection; -import java.util.Optional; -import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.jaxb.JAXBValidationContext; import org.rutebanken.netex.model.DatedServiceJourney; import org.rutebanken.netex.model.DatedServiceJourneyRefStructure; -import org.rutebanken.netex.model.ServiceAlterationEnumeration; public class ServiceAlterationUtils { private ServiceAlterationUtils() {} - public static DatedServiceJourneyRefStructure datedServiceJourneyRef( - DatedServiceJourney datedServiceJourney - ) { - return datedServiceJourney - .getJourneyRef() - .stream() - .map(JAXBElement::getValue) - .filter(DatedServiceJourneyRefStructure.class::isInstance) - .map(DatedServiceJourneyRefStructure.class::cast) - .findFirst() - .orElse(null); - } - - public static Collection datedServiceJourneysWithReferenceToReplaced( + public static Collection datedServiceJourneysWithReferenceToOriginal( JAXBValidationContext validationContext ) { return validationContext .datedServiceJourneys() .stream() - .filter(dsj -> dsj.getJourneyRef() != null) .filter(dsj -> dsj .getJourneyRef() @@ -42,27 +25,4 @@ public static Collection datedServiceJourneysWithReferenceT ) .toList(); } - - public static Collection replacedDatedServiceJourneys( - JAXBValidationContext validationContext - ) { - return validationContext - .datedServiceJourneys() - .stream() - .filter(dsj -> - dsj.getServiceAlteration() == ServiceAlterationEnumeration.REPLACED - ) - .toList(); - } - - public static DatedServiceJourney datedServiceJourney( - DatedServiceJourneyRefStructure datedServiceJourneyRefStructure, - NetexEntitiesIndex netexEntitiesIndex - ) { - return Optional - .ofNullable(datedServiceJourneyRefStructure) - .map(DatedServiceJourneyRefStructure::getRef) - .map(ref -> netexEntitiesIndex.getDatedServiceJourneyIndex().get(ref)) - .orElse(null); - } } diff --git a/src/main/java/no/entur/antu/validation/validator/support/JourneyPatternUtils.java b/src/main/java/no/entur/antu/validation/validator/support/JourneyPatternUtils.java index 80314d05..d155d243 100644 --- a/src/main/java/no/entur/antu/validation/validator/support/JourneyPatternUtils.java +++ b/src/main/java/no/entur/antu/validation/validator/support/JourneyPatternUtils.java @@ -1,7 +1,6 @@ package no.entur.antu.validation.validator.support; import java.util.Map; -import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.jaxb.JAXBValidationContext; import org.entur.netex.validation.validator.model.QuayCoordinates; import org.entur.netex.validation.validator.model.QuayId; @@ -10,6 +9,8 @@ public class JourneyPatternUtils { + private JourneyPatternUtils() {} + public static Map.Entry coordinatesPerQuayId( StopPointInJourneyPattern stopPointInJourneyPattern, JAXBValidationContext validationContext diff --git a/src/test/java/no/entur/antu/netextestdata/NetexTestFragment.java b/src/test/java/no/entur/antu/netextestdata/NetexEntitiesTestFactory.java similarity index 98% rename from src/test/java/no/entur/antu/netextestdata/NetexTestFragment.java rename to src/test/java/no/entur/antu/netextestdata/NetexEntitiesTestFactory.java index f612d306..abeb2eea 100644 --- a/src/test/java/no/entur/antu/netextestdata/NetexTestFragment.java +++ b/src/test/java/no/entur/antu/netextestdata/NetexEntitiesTestFactory.java @@ -8,7 +8,6 @@ import java.time.Duration; import java.time.LocalDate; import java.time.LocalTime; -import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -28,10 +27,8 @@ import org.entur.netex.validation.validator.model.ServiceJourneyId; import org.rutebanken.netex.model.*; -public class NetexTestFragment { +public class NetexEntitiesTestFactory { - private static final DateTimeFormatter DATE_FORMATTER = - DateTimeFormatter.ofPattern("yyyy-MM-dd"); private static final DayType EVERYDAY = new DayType() .withId("EVERYDAY") .withName(new MultilingualString().withValue("everyday")); @@ -1086,34 +1083,6 @@ public NetexEntitiesIndex create() { netexEntitiesIndex.getRouteIndex().put(route.getId(), route); } - serviceJourneys.forEach(journey -> - netexEntitiesIndex - .getServiceJourneyIndex() - .put(journey.getId(), journey) - ); - datedServiceJourneys.forEach(dsj -> - netexEntitiesIndex.getDatedServiceJourneyIndex().put(dsj.getId(), dsj) - ); - deadRuns.forEach(deadRun -> - netexEntitiesIndex.getDeadRunIndex().put(deadRun.getId(), deadRun) - ); - - interchanges.forEach(interchange -> - netexEntitiesIndex - .getServiceJourneyInterchangeIndex() - .put(interchange.getId(), interchange) - ); - serviceLinks.forEach(serviceLink -> - netexEntitiesIndex - .getServiceLinkIndex() - .put(serviceLink.getId(), serviceLink) - ); - flexibleStopPlaces.forEach(flexibleStopPlace -> - netexEntitiesIndex - .getFlexibleStopPlaceIndex() - .put(flexibleStopPlace.getId(), flexibleStopPlace) - ); - fillIndexes(netexEntitiesIndex); return netexEntitiesIndex; } @@ -1166,6 +1135,21 @@ private void fillIndexes(NetexEntitiesIndex netexEntitiesIndex) { .getDatedServiceJourneyIndex() .put(journey.getId(), journey) ); + + deadRuns.forEach(deadRun -> + netexEntitiesIndex.getDeadRunIndex().put(deadRun.getId(), deadRun) + ); + + serviceLinks.forEach(serviceLink -> + netexEntitiesIndex + .getServiceLinkIndex() + .put(serviceLink.getId(), serviceLink) + ); + flexibleStopPlaces.forEach(flexibleStopPlace -> + netexEntitiesIndex + .getFlexibleStopPlaceIndex() + .put(flexibleStopPlace.getId(), flexibleStopPlace) + ); } public void addDatedServiceJourneys( diff --git a/src/test/java/no/entur/antu/validation/flex/validator/flexiblearea/InvalidFlexibleAreaValidatorTest.java b/src/test/java/no/entur/antu/validation/flex/validator/flexiblearea/InvalidFlexibleAreaValidatorTest.java index 352e8884..f2f3fd02 100644 --- a/src/test/java/no/entur/antu/validation/flex/validator/flexiblearea/InvalidFlexibleAreaValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/flex/validator/flexiblearea/InvalidFlexibleAreaValidatorTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.List; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -26,7 +26,7 @@ private ValidationReport runValidation( @Test void testDataSetWithoutFlexibleStopPlacesShouldBeIgnoredGracefully() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ValidationReport validationReport = runValidation( testData.netexEntitiesIndex().create() @@ -177,10 +177,10 @@ void testMissingCoordinatesShouldFail() { @Test void testMissingFlexibleStopAreaShouldIgnoreValidationGracefully() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); FlexibleStopPlace flexibleStopPlace = - new NetexTestFragment.CreateFlexibleStopPlace().create(); + new NetexEntitiesTestFactory.CreateFlexibleStopPlace().create(); ValidationReport validationReport = runValidation( testData.netexEntitiesIndex(flexibleStopPlace).create() @@ -191,7 +191,7 @@ void testMissingFlexibleStopAreaShouldIgnoreValidationGracefully() { @Test void testMissingPolygonShouldIgnoreValidationGracefully2() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); FlexibleArea flexibleArea = testData.flexibleArea().create(); @@ -209,7 +209,7 @@ void testMissingPolygonShouldIgnoreValidationGracefully2() { private ValidationReport runTestWithGivenCoordinates( List coordinates ) { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); FlexibleArea flexibleArea = testData .flexibleArea() diff --git a/src/test/java/no/entur/antu/validation/validator/interchange/distance/UnexpectedInterchangeDistanceValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/interchange/distance/UnexpectedInterchangeDistanceValidatorTest.java index 01e02df6..7ca99fd5 100644 --- a/src/test/java/no/entur/antu/validation/validator/interchange/distance/UnexpectedInterchangeDistanceValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/interchange/distance/UnexpectedInterchangeDistanceValidatorTest.java @@ -7,7 +7,7 @@ import java.util.Collection; import java.util.List; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -169,7 +169,7 @@ private ValidationReport runTestWithCoordinates( ) { assert coordinates.length % 2 == 0; - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); List serviceJourneyInterchanges = IntStream .rangeClosed(1, coordinates.length / 2) diff --git a/src/test/java/no/entur/antu/validation/validator/interchange/duplicate/DuplicateInterchangesValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/interchange/duplicate/DuplicateInterchangesValidatorTest.java index c3b7f6ed..43e6cb4f 100644 --- a/src/test/java/no/entur/antu/validation/validator/interchange/duplicate/DuplicateInterchangesValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/interchange/duplicate/DuplicateInterchangesValidatorTest.java @@ -12,7 +12,7 @@ import java.util.regex.Pattern; import java.util.stream.IntStream; import java.util.stream.Stream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -40,7 +40,7 @@ void testNoDuplicateInterchanges() { List serviceJourneyInterchanges = createServiceJourneyInterchanges(5); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ValidationReport validationReport = runValidation( testData .netexEntitiesIndex() @@ -58,7 +58,7 @@ void testAllDuplicate() { List serviceJourneyInterchanges = createServiceJourneyInterchanges(5, 0, 0, 1, 2, 3, 4); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ValidationReport validationReport = runValidation( testData .netexEntitiesIndex() @@ -76,8 +76,8 @@ void testAllDuplicate() { .map(ValidationReportEntry::getMessage) .orElseThrow(); - // assert that 4 distinct interchanges are reported among the 4 identical ones. - // TODO the validator should report all 4 identical interchanges + // assert that 4 distinct interchanges are reported among the 5 identical ones. + // TODO the validator should report all 5 identical interchanges Pattern pattern = Pattern.compile("TST:ServiceJourneyInterchange:[0-4]*"); assertEquals( @@ -96,7 +96,7 @@ void testSomeDuplicateInterchanges() { List serviceJourneyInterchanges = createServiceJourneyInterchanges(5, 1, 2, 3); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ValidationReport validationReport = runValidation( testData .netexEntitiesIndex() @@ -130,7 +130,7 @@ void testMultiplePairsOfDuplicateInterchanges() { List serviceJourneyInterchanges2 = createServiceJourneyInterchanges(5, 6, 7, 8); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); NetexEntitiesIndex netexEntitiesIndex = testData .netexEntitiesIndex() .addInterchanges( @@ -193,7 +193,7 @@ private List createServiceJourneyInterchanges( int startIndex, int... duplicateIndexes ) { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); int maxStartIndex = Math.max(startIndex, 0); @@ -207,7 +207,7 @@ private List createServiceJourneyInterchanges( .boxed() .toList(); - List createServiceJourneyInterchanges = + List createServiceJourneyInterchanges = IntStream .range( maxStartIndex, @@ -217,7 +217,7 @@ private List createServiceJourneyInterchanges( duplicateIndexesList.contains(index) ? maxStartIndex : index ) .mapToObj(index -> - new NetexTestFragment.CreateServiceJourneyInterchange() + new NetexEntitiesTestFactory.CreateServiceJourneyInterchange() .withFromJourneyRef( ServiceJourneyId.ofValidId(serviceJourneys.get(index * 2)) ) diff --git a/src/test/java/no/entur/antu/validation/validator/interchange/mandatoryfields/MandatoryFieldsValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/interchange/mandatoryfields/MandatoryFieldsValidatorTest.java index ef1dbb66..84b7f4be 100644 --- a/src/test/java/no/entur/antu/validation/validator/interchange/mandatoryfields/MandatoryFieldsValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/interchange/mandatoryfields/MandatoryFieldsValidatorTest.java @@ -4,7 +4,7 @@ import static org.hamcrest.Matchers.is; import java.util.List; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -36,13 +36,15 @@ void testAllMandatoryFieldArePresent() { "TST:ScheduledStopPoint:2" ); - NetexTestFragment netexFragment = new NetexTestFragment(); - List serviceJourneys = netexFragment.createServiceJourneys( - netexFragment.journeyPattern().create(), - 2 - ); + NetexEntitiesTestFactory netexEntitiesFactory = + new NetexEntitiesTestFactory(); + List serviceJourneys = + netexEntitiesFactory.createServiceJourneys( + netexEntitiesFactory.journeyPattern().create(), + 2 + ); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withFromJourneyRef(ServiceJourneyId.ofValidId(serviceJourneys.get(0))) @@ -59,7 +61,7 @@ void testAllMandatoryFieldArePresent() { mockGetQuayId(scheduledStopPointId2, new QuayId("TST:Quay:2")); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys(serviceJourneys.toArray(ServiceJourney[]::new)) .addInterchanges(serviceJourneyInterchange) @@ -78,13 +80,14 @@ void testFromServiceJourneyRefMissing() { "TST:ScheduledStopPoint:2" ); - NetexTestFragment netexFragment = new NetexTestFragment(); + NetexEntitiesTestFactory netexEntitiesFactory = + new NetexEntitiesTestFactory(); - ServiceJourney serviceJourney = netexFragment - .serviceJourney(netexFragment.journeyPattern().create()) + ServiceJourney serviceJourney = netexEntitiesFactory + .serviceJourney(netexEntitiesFactory.journeyPattern().create()) .create(); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withToJourneyRef(ServiceJourneyId.ofValidId(serviceJourney)) @@ -97,7 +100,7 @@ void testFromServiceJourneyRefMissing() { mockGetQuayId(scheduledStopPointId2, new QuayId("TST:Quay:2")); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys(serviceJourney) .addInterchanges(serviceJourneyInterchange) @@ -127,13 +130,14 @@ void testToServiceJourneyRefMissing() { "TST:ScheduledStopPoint:2" ); - NetexTestFragment netexFragment = new NetexTestFragment(); + NetexEntitiesTestFactory netexEntitiesFactory = + new NetexEntitiesTestFactory(); - ServiceJourney serviceJourney = netexFragment - .serviceJourney(netexFragment.journeyPattern().create()) + ServiceJourney serviceJourney = netexEntitiesFactory + .serviceJourney(netexEntitiesFactory.journeyPattern().create()) .create(); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withFromJourneyRef(ServiceJourneyId.ofValidId(serviceJourney)) @@ -149,7 +153,7 @@ void testToServiceJourneyRefMissing() { ); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys(serviceJourney) .addInterchanges(serviceJourneyInterchange) @@ -176,13 +180,14 @@ void testFromPointRefMissing() { "TST:ScheduledStopPoint:1" ); - NetexTestFragment netexFragment = new NetexTestFragment(); + NetexEntitiesTestFactory netexEntitiesFactory = + new NetexEntitiesTestFactory(); - ServiceJourney serviceJourney = netexFragment - .serviceJourney(netexFragment.journeyPattern().create()) + ServiceJourney serviceJourney = netexEntitiesFactory + .serviceJourney(netexEntitiesFactory.journeyPattern().create()) .create(); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withFromJourneyRef(ServiceJourneyId.ofValidId(serviceJourney)) @@ -193,7 +198,7 @@ void testFromPointRefMissing() { mockGetQuayId(scheduledStopPointId, new QuayId("TST:Quay:1")); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys(serviceJourney) .addInterchanges(serviceJourneyInterchange) @@ -220,13 +225,14 @@ void testToPointRefMissing() { "TST:ScheduledStopPoint:1" ); - NetexTestFragment netexFragment = new NetexTestFragment(); + NetexEntitiesTestFactory netexEntitiesFactory = + new NetexEntitiesTestFactory(); - ServiceJourney serviceJourney = netexFragment - .serviceJourney(netexFragment.journeyPattern().create()) + ServiceJourney serviceJourney = netexEntitiesFactory + .serviceJourney(netexEntitiesFactory.journeyPattern().create()) .create(); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withFromJourneyRef(ServiceJourneyId.ofValidId(serviceJourney)) @@ -237,7 +243,7 @@ void testToPointRefMissing() { mockGetQuayId(scheduledStopPointId, new QuayId("TST:Quay:1")); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys(serviceJourney) .addInterchanges(serviceJourneyInterchange) @@ -268,13 +274,13 @@ void testFromPointRefHasNoAssignment() { "TST:ScheduledStopPoint:2" ); - NetexTestFragment netexFragment = new NetexTestFragment(); - List serviceJourneys = netexFragment.createServiceJourneys( - netexFragment.journeyPattern().create(), + NetexTestFragment netexEntitiesFactory = new NetexTestFragment(); + List serviceJourneys = netexEntitiesFactory.createServiceJourneys( + netexEntitiesFactory.journeyPattern().create(), 2 ); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withFromJourneyRef(serviceJourneys.get(0).getId()) @@ -289,7 +295,7 @@ void testFromPointRefHasNoAssignment() { ); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys( serviceJourneys.toArray(Journey_VersionStructure[]::new) @@ -321,13 +327,13 @@ void testToPointRefHasNoAssignment() { "TST:ScheduledStopPoint:2" ); - NetexTestFragment netexFragment = new NetexTestFragment(); - List serviceJourneys = netexFragment.createServiceJourneys( - netexFragment.journeyPattern().create(), + NetexTestFragment netexEntitiesFactory = new NetexTestFragment(); + List serviceJourneys = netexEntitiesFactory.createServiceJourneys( + netexEntitiesFactory.journeyPattern().create(), 2 ); - ServiceJourneyInterchange serviceJourneyInterchange = netexFragment + ServiceJourneyInterchange serviceJourneyInterchange = netexEntitiesFactory .serviceJourneyInterchange() .withId(1) .withFromJourneyRef(serviceJourneys.get(0).getId()) @@ -342,7 +348,7 @@ void testToPointRefHasNoAssignment() { ); ValidationReport validationReport = runValidation( - netexFragment + netexEntitiesFactory .netexEntitiesIndex() .addServiceJourneys( serviceJourneys.toArray(Journey_VersionStructure[]::new) diff --git a/src/test/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyValidatorTest.java index 9a73740b..1f8afa1d 100644 --- a/src/test/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/interchange/stoppoints/StopPointsInVehicleJourneyValidatorTest.java @@ -6,7 +6,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.validation.validator.ValidationReport; import org.entur.netex.validation.validator.ValidationReportEntry; @@ -97,7 +97,7 @@ void noInterchangeNoEffect() { @Test void interchangeWithMissingAttributes() { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); ServiceJourneyInterchange serviceJourneyInterchange = fragment .serviceJourneyInterchange() .create(); @@ -157,7 +157,7 @@ private ValidationReport runTestFor( assert fromServiceJourneyId != toServiceJourneyId; assert fromPointRefId != toPointRefId; - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); ScheduledStopPointId fromPointRef = new ScheduledStopPointId( "TST:ScheduledStopPoint:" + fromPointRefId diff --git a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/distance/UnexpectedDistanceBetweenStopPointsValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/distance/UnexpectedDistanceBetweenStopPointsValidatorTest.java index a554fac5..9ceaf69b 100644 --- a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/distance/UnexpectedDistanceBetweenStopPointsValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/distance/UnexpectedDistanceBetweenStopPointsValidatorTest.java @@ -8,7 +8,7 @@ import java.util.Collections; import java.util.List; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -167,16 +167,14 @@ private ValidationReport runWithQuayCoordinates( AllVehicleModesOfTransportEnumeration transportMode, List coordinates ) { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); Line line = testFragment.line().withTransportMode(transportMode).create(); Route route = testFragment.route().withLine(line).create(); - NetexTestFragment.CreateJourneyPattern createJourneyPattern = testFragment - .journeyPattern() - .withId(123) - .withRoute(route); + NetexEntitiesTestFactory.CreateJourneyPattern createJourneyPattern = + testFragment.journeyPattern().withId(123).withRoute(route); if (coordinates.isEmpty()) { createJourneyPattern.withNumberOfStopPointInJourneyPattern(0); diff --git a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/identicalstoppoints/IdenticalStopPointsValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/identicalstoppoints/IdenticalStopPointsValidatorTest.java index 8bf3e62f..e8aaaef7 100644 --- a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/identicalstoppoints/IdenticalStopPointsValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/identicalstoppoints/IdenticalStopPointsValidatorTest.java @@ -6,8 +6,8 @@ import java.util.List; import java.util.function.UnaryOperator; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; -import no.entur.antu.netextestdata.NetexTestFragment.CreateStopPointInJourneyPattern; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory.CreateStopPointInJourneyPattern; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -143,9 +143,9 @@ private ValidationReport getValidationReport( int numberOfStopPoints, UnaryOperator customizeStopPoint ) { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); - List createJourneyPatterns = + List createJourneyPatterns = IntStream .rangeClosed(1, numberOfJourneyPatterns) .mapToObj(journeyPatternId -> @@ -199,7 +199,7 @@ private ValidationReport getValidationReport( .addJourneyPatterns( createJourneyPatterns .stream() - .map(NetexTestFragment.CreateJourneyPattern::create) + .map(NetexEntitiesTestFactory.CreateJourneyPattern::create) .toArray(JourneyPattern[]::new) ) .create() diff --git a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samequayref/SameQuayRefValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samequayref/SameQuayRefValidatorTest.java index 01468550..d2b087f4 100644 --- a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samequayref/SameQuayRefValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samequayref/SameQuayRefValidatorTest.java @@ -4,7 +4,7 @@ import static org.hamcrest.Matchers.is; import java.util.List; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -26,7 +26,7 @@ private ValidationReport runValidation( @Test void testNoStopPointsInJourneyPattern() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testFragment .journeyPattern() @@ -46,7 +46,7 @@ void testNoStopPointsInJourneyPattern() { @Test void testNoSameQuayRefOnStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testFragment .journeyPattern() @@ -89,7 +89,7 @@ void testNoSameQuayRefOnStopPoints() { @Test void testSameQuayRefOnStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testFragment .journeyPattern() diff --git a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samestoppoints/SameStopPointsValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samestoppoints/SameStopPointsValidatorTest.java index 71cba64e..b97bac93 100644 --- a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samestoppoints/SameStopPointsValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/samestoppoints/SameStopPointsValidatorTest.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -25,9 +25,9 @@ private ValidationReport runValidation( @Test void testAllJourneyPatternsHaveDifferentStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testFragment.netexEntitiesIndex(); IntStream @@ -55,10 +55,10 @@ void testAllJourneyPatternsHaveDifferentStopPoints() { @Test void testAllJourneyPatternsHaveSameStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int sameStopPointId = 987; - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testFragment.netexEntitiesIndex(); IntStream @@ -89,7 +89,7 @@ void testAllJourneyPatternsHaveSameStopPoints() { @Test void testMultiplePairsOfJourneyPatternsHaveSameStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int sameStopPointId1 = 987; int sameStopPointId2 = 988; @@ -162,7 +162,7 @@ void testMultiplePairsOfJourneyPatternsHaveSameStopPoints() { @Test void testAllJourneyPatternsWithMultipleStopPointsHaveSameStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int stopPointInJourneyPatternId = 987; JourneyPattern journeyPattern1 = testFragment .journeyPattern() @@ -208,10 +208,10 @@ void testAllJourneyPatternsWithMultipleStopPointsHaveSameStopPoints() { @Test void testTwoJourneyPatternsOutOfTenHaveSameStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int stopPointInJourneyPatternId = 987; - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testFragment.netexEntitiesIndex(); IntStream @@ -273,7 +273,7 @@ void testTwoJourneyPatternsOutOfTenHaveSameStopPoints() { @Test void testJourneyPatternsWithUnSortedSameStopPoints() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int stopPointInJourneyPatternId = 987; List stopPointsOrder1 = List.of(8, 3, 5, 2, 4, 10, 9, 1, 7, 6); diff --git a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/stoppointscount/StopPointsCountValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/stoppointscount/StopPointsCountValidatorTest.java index d3aadd5a..a09e7a30 100644 --- a/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/stoppointscount/StopPointsCountValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/journeypattern/stoppoint/stoppointscount/StopPointsCountValidatorTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -44,7 +44,7 @@ void testJourneyPatternWithInCorrectStopPointsAndServiceLinksCount( @Test void testJourneyPatternWithNoServiceLinks() { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int stopPointInJourneyPatternIdOffset = 123; JourneyPattern journeyPattern = testFragment @@ -75,7 +75,7 @@ void testJourneyPatternWithNoServiceLinks() { } private ValidationReport runWith10StopPoints(int numberOfServiceLinks) { - NetexTestFragment testFragment = new NetexTestFragment(); + NetexEntitiesTestFactory testFragment = new NetexEntitiesTestFactory(); int stopPointInJourneyPatternIdOffset = 123; int linksInJourneyPatternIdOffset = 234; diff --git a/src/test/java/no/entur/antu/validation/validator/passengerstopassignemnt/MissingPassengerStopAssignmentValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/passengerstopassignemnt/MissingPassengerStopAssignmentValidatorTest.java index f8e43e8e..62ca1d57 100644 --- a/src/test/java/no/entur/antu/validation/validator/passengerstopassignemnt/MissingPassengerStopAssignmentValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/passengerstopassignemnt/MissingPassengerStopAssignmentValidatorTest.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import no.entur.antu.validation.validator.passengerstopassignment.MissingPassengerStopAssignmentValidator; import org.entur.netex.index.api.NetexEntitiesIndex; @@ -33,7 +33,7 @@ private ValidationReport runValidation( @Test void testAllStopPlaceAssignmentsExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -65,7 +65,7 @@ void testAllStopPlaceAssignmentsExists() { @Test void testMissingStopPlaceAssignmentsButServiceJourneyExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -101,13 +101,13 @@ void testMissingStopPlaceAssignmentsButServiceJourneyExists() { * Missing SPA -> No DeadRun -> Yes SJ -> Error */ void testMissingSingleStopPlaceAssignmentsUsedInMultipleJourneyPatternsButServiceJourneyExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); List journeyPatterns = testData.createJourneyPatterns(4); Line line = testData.line().create(); List serviceJourneys = journeyPatterns .stream() .map(journeyPattern -> testData.serviceJourney(line, journeyPattern)) - .map(NetexTestFragment.CreateServiceJourney::create) + .map(NetexEntitiesTestFactory.CreateServiceJourney::create) .map(ServiceJourney.class::cast) .toList(); @@ -127,7 +127,7 @@ void testMissingSingleStopPlaceAssignmentsUsedInMultipleJourneyPatternsButServic * Missing SPA -> No DeadRun -> No SJ -> Error */ void testMissingStopPlaceAssignmentsAndNoServiceJourneyExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); NetexEntitiesIndex netexEntitiesIndex = new NetexEntitiesIndexImpl(); @@ -145,7 +145,7 @@ void testMissingStopPlaceAssignmentsAndNoServiceJourneyExists() { * Missing SPA -> Yes DeadRun -> No SJ -> OK */ void testMissingStopPlaceAssignmentsAndDeadRunExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); DeadRun deadRun = testData.deadRun(journeyPattern).create(); @@ -165,7 +165,7 @@ void testMissingStopPlaceAssignmentsAndDeadRunExists() { * Missing SPA -> Yes DeadRun -> Yes SJ -> Error */ void testMissingStopPlaceAssignmentsAndBothDeadRunAndServiceJourneyExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); Line line = testData.line().create(); DeadRun deadRun = testData.deadRun(line, journeyPattern).create(); @@ -187,7 +187,7 @@ void testMissingStopPlaceAssignmentsAndBothDeadRunAndServiceJourneyExists() { @Test void testMissingMultipleStopPlaceAssignmentsButServiceJourneyExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -220,13 +220,13 @@ void testMissingMultipleStopPlaceAssignmentsButServiceJourneyExists() { @Test void testPassengerStopAssignmentsInLineFileAndNotOnCommonFileShouldBeOk() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) .create(); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testData.netexEntitiesIndex(journeyPattern, serviceJourney); IntStream diff --git a/src/test/java/no/entur/antu/validation/validator/servicejourney/passingtime/NonIncreasingTimetabledPassingTimeValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/servicejourney/passingtime/NonIncreasingTimetabledPassingTimeValidatorTest.java index 6c0752b7..26485d3f 100644 --- a/src/test/java/no/entur/antu/validation/validator/servicejourney/passingtime/NonIncreasingTimetabledPassingTimeValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/servicejourney/passingtime/NonIncreasingTimetabledPassingTimeValidatorTest.java @@ -4,7 +4,7 @@ import static org.hamcrest.Matchers.is; import java.time.LocalTime; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import no.entur.antu.validation.validator.servicejourney.passingtime.NonIncreasingPassingTimeError.RuleCode; import org.entur.netex.index.api.NetexEntitiesIndex; @@ -30,7 +30,7 @@ private ValidationReport runValidation( @Test void testValidateServiceJourneyWithRegularStop() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -45,7 +45,7 @@ void testValidateServiceJourneyWithRegularStop() { @Test void testValidateServiceJourneyWithRegularStopMissingTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -75,7 +75,7 @@ void testValidateServiceJourneyWithRegularStopMissingTime() { @Test void testValidateServiceJourneyWithRegularStopInconsistentTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -107,7 +107,7 @@ void testValidateServiceJourneyWithRegularStopInconsistentTime() { @Test void testValidateServiceJourneyWithAreaStop() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -135,7 +135,7 @@ void testValidateServiceJourneyWithAreaStop() { @Test void testValidateServiceJourneyWithAreaStopMissingTimeWindow() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -170,7 +170,7 @@ void testValidateServiceJourneyWithAreaStopMissingTimeWindow() { @Test void testValidateServiceJourneyWithAreaStopInconsistentTimeWindow() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -210,7 +210,7 @@ void testValidateServiceJourneyWithAreaStopInconsistentTimeWindow() { @Test void testValidateServiceJourneyWithRegularStopFollowedByRegularStopNonIncreasingTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -251,7 +251,7 @@ void testValidateServiceJourneyWithRegularStopFollowedByRegularStopNonIncreasing */ @Test void testValidateWithRegularStopFollowedByRegularStopWithMissingTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -282,7 +282,7 @@ void testValidateWithRegularStopFollowedByRegularStopWithMissingTime() { @Test void testValidateServiceJourneyWithRegularStopFollowedByStopArea() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -315,7 +315,7 @@ void testValidateServiceJourneyWithRegularStopFollowedByStopArea() { @Test void testValidateServiceJourneyWithRegularStopFollowedByStopAreaNonIncreasingTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -362,7 +362,7 @@ void testValidateServiceJourneyWithRegularStopFollowedByStopAreaNonIncreasingTim @Test void testValidateServiceJourneyWithStopAreaFollowedByRegularStop() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -393,7 +393,7 @@ void testValidateServiceJourneyWithStopAreaFollowedByRegularStop() { @Test void testValidateServiceJourneyWithStopAreaFollowedByStopArea() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -439,7 +439,7 @@ void testValidateServiceJourneyWithStopAreaFollowedByStopArea() { @Test void testValidateServiceJourneyWithStopAreaFollowedByStopAreaNonIncreasingTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) @@ -502,7 +502,7 @@ void testValidateServiceJourneyWithStopAreaFollowedByStopAreaNonIncreasingTime() @Test void testValidateServiceJourneyWithStopAreaFollowedByRegularStopNonIncreasingTime() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) diff --git a/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidatorTest.java index 4f09f3df..b8b68e23 100644 --- a/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/InvalidServiceAlterationValidatorTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -27,7 +27,7 @@ private ValidationReport runValidation( @Test void testCorrectServiceAlterationExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); DatedServiceJourney datedServiceJourneyReplaced = testData .datedServiceJourney(1) @@ -56,9 +56,9 @@ void testCorrectServiceAlterationExists() { @Test void testCorrectServiceAlterationExistsForMultipleDSJs() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testData.netexEntitiesIndex(); IntStream @@ -92,7 +92,7 @@ void testCorrectServiceAlterationExistsForMultipleDSJs() { @Test void testServiceAlterationMissing() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); DatedServiceJourney datedServiceJourneyReplaced = testData .datedServiceJourney(1) @@ -129,9 +129,9 @@ void testServiceAlterationMissing() { @Test void testServiceAlterationMissingForMultipleDSJs() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testData.netexEntitiesIndex(); IntStream @@ -168,7 +168,7 @@ void testServiceAlterationMissingForMultipleDSJs() { @Test void testUnexpectedServiceAlteration() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); DatedServiceJourney datedServiceJourneyReplaced = testData .datedServiceJourney(1) diff --git a/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidatorTest.java index 42cfc601..22e99e9e 100644 --- a/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/servicejourney/servicealteration/MissingReplacementValidatorTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -27,7 +27,7 @@ private ValidationReport runValidation( @Test void testCorrectReplacementExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); DatedServiceJourney datedServiceJourneyReplaced = testData .datedServiceJourney(1) @@ -56,7 +56,7 @@ void testCorrectReplacementExists() { @Test void testReplacementDoesNotExists() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); DatedServiceJourney datedServiceJourneyReplaced = testData .datedServiceJourney(1) @@ -93,9 +93,9 @@ void testReplacementDoesNotExists() { @Test void testReplacementMissingForMultipleDSJs() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testData.netexEntitiesIndex(); IntStream diff --git a/src/test/java/no/entur/antu/validation/validator/servicejourney/speed/UnexpectedSpeedValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/servicejourney/speed/UnexpectedSpeedValidatorTest.java index 5d7d6cee..7f887592 100644 --- a/src/test/java/no/entur/antu/validation/validator/servicejourney/speed/UnexpectedSpeedValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/servicejourney/speed/UnexpectedSpeedValidatorTest.java @@ -4,7 +4,7 @@ import static org.hamcrest.Matchers.is; import java.util.List; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -141,7 +141,7 @@ void multipleSpeedViolationShouldBeDetected() { @Test void testSameDepartureArrivalTimeErrorThrown() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData .journeyPattern() .withNumberOfStopPointInJourneyPattern(2) @@ -189,14 +189,14 @@ void testPassengerStopAssignmentsInLineFileAndNotOnCommonFileShouldBeOk() { new QuayCoordinates(6.632312, 60.491548) ); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) .create(); serviceJourney.withTransportMode(AllVehicleModesOfTransportEnumeration.BUS); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testData.netexEntitiesIndex(journeyPattern, serviceJourney); mockNoQuayIdsInNetexDataRepository(); @@ -228,14 +228,14 @@ void testPassengerStopAssignmentsInLineFileAndNotOnCommonFileShouldBeOk() { @Test void testNoPassengerStopAssignmentsFoundShouldIgnoreValidationGracefully() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) .create(); serviceJourney.withTransportMode(AllVehicleModesOfTransportEnumeration.BUS); - NetexTestFragment.CreateNetexEntitiesIndex createNetexEntitiesIndex = + NetexEntitiesTestFactory.CreateNetexEntitiesIndex createNetexEntitiesIndex = testData.netexEntitiesIndex(journeyPattern, serviceJourney); mockNoQuayIdsInNetexDataRepository(); @@ -250,7 +250,7 @@ void testNoPassengerStopAssignmentsFoundShouldIgnoreValidationGracefully() { private ValidationReport runTestWithQuayCoordinates( List quayCoordinates ) { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); JourneyPattern journeyPattern = testData.journeyPattern().create(); ServiceJourney serviceJourney = testData .serviceJourney(journeyPattern) diff --git a/src/test/java/no/entur/antu/validation/validator/servicelink/distance/UnexpectedDistanceInServiceLinkValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/servicelink/distance/UnexpectedDistanceInServiceLinkValidatorTest.java index f07c1ce5..f410c041 100644 --- a/src/test/java/no/entur/antu/validation/validator/servicelink/distance/UnexpectedDistanceInServiceLinkValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/servicelink/distance/UnexpectedDistanceInServiceLinkValidatorTest.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Optional; import net.opengis.gml._3.DirectPositionType; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -363,7 +363,7 @@ void validationShouldBeIgnoredInCaseOfInvalidLineStringWithOddNumberOfCoordinate @Test void datasetWithoutServiceLinksShouldBeIgnored() { - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ValidationReport validationReport = runValidation( testData.netexEntitiesIndex().create() @@ -384,7 +384,7 @@ private ValidationReport runTestWithDirectPositionType( "TST:ScheduledStopPoint:2" ); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ServiceLink serviceLink = testData .serviceLink(fromStopPointId.id(), toStopPointId.id()) .withLineStringPositions(lineStringCoordinates) @@ -416,7 +416,7 @@ private ValidationReport runTestWith( "TST:ScheduledStopPoint:2" ); - NetexTestFragment testData = new NetexTestFragment(); + NetexEntitiesTestFactory testData = new NetexEntitiesTestFactory(); ServiceLink serviceLink = testData .serviceLink(fromStopPointId.id(), toStopPointId.id()) .withLineStringList(lineStringCoordinates) diff --git a/src/test/java/no/entur/antu/validation/validator/servicelink/stoppoints/MismatchedStopPointsValidatorTest.java b/src/test/java/no/entur/antu/validation/validator/servicelink/stoppoints/MismatchedStopPointsValidatorTest.java index 135f0f6c..1d15af97 100644 --- a/src/test/java/no/entur/antu/validation/validator/servicelink/stoppoints/MismatchedStopPointsValidatorTest.java +++ b/src/test/java/no/entur/antu/validation/validator/servicelink/stoppoints/MismatchedStopPointsValidatorTest.java @@ -7,7 +7,7 @@ import java.util.function.BiFunction; import java.util.stream.Collector; import java.util.stream.IntStream; -import no.entur.antu.netextestdata.NetexTestFragment; +import no.entur.antu.netextestdata.NetexEntitiesTestFactory; import no.entur.antu.validation.ValidationTest; import org.entur.netex.index.api.NetexEntitiesIndex; import org.entur.netex.validation.validator.ValidationReport; @@ -32,7 +32,7 @@ private ValidationReport runValidation( @Test void testStopPointsInServiceLinkMatchesJourneyPattern() { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); int numberOfJourneyPatterns = 1; int numberOfStopPointsInJourneyPattern = 2; @@ -56,7 +56,7 @@ void testStopPointsInServiceLinkMatchesJourneyPattern() { @Test void testStopPointsInAllServiceLinkMatchesAllJourneyPattern() { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); int numberOfJourneyPatterns = 5; int numberOfStopPointsInJourneyPattern = 5; @@ -80,7 +80,7 @@ void testStopPointsInAllServiceLinkMatchesAllJourneyPattern() { @Test void testServiceLinkMissing() { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); int numberOfJourneyPatterns = 5; int numberOfServiceLinks = 4; @@ -106,7 +106,7 @@ void testServiceLinkMissing() { @Test void testFromStopPointInServiceLinkDoesNotMatchesJourneyPattern() { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); int journeyPatternId = 1; StopPointInJourneyPattern fromStopPointInJourneyPattern = fragment @@ -169,7 +169,7 @@ void testFromStopPointInServiceLinkDoesNotMatchesJourneyPattern() { @Test void testToStopPointInServiceLinkDoesNotMatchesJourneyPattern() { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); int journeyPatternId = 1; StopPointInJourneyPattern fromStopPoint = fragment @@ -230,14 +230,14 @@ void testToStopPointInServiceLinkDoesNotMatchesJourneyPattern() { ); } - private static @NotNull Collector collectToNetexEntitiesIndex( - NetexTestFragment fragment + private static @NotNull Collector collectToNetexEntitiesIndex( + NetexEntitiesTestFactory fragment ) { return Collector.of( fragment::netexEntitiesIndex, - NetexTestFragment.CreateNetexEntitiesIndex::addJourneyPatterns, + NetexEntitiesTestFactory.CreateNetexEntitiesIndex::addJourneyPatterns, (createLeft, createRight) -> createLeft, - NetexTestFragment.CreateNetexEntitiesIndex::create + NetexEntitiesTestFactory.CreateNetexEntitiesIndex::create ); } @@ -274,7 +274,7 @@ private List createJourneyPatterns( int numberOfJourneyPatterns, int numberOfStopPointsInJourneyPattern ) { - NetexTestFragment fragment = new NetexTestFragment(); + NetexEntitiesTestFactory fragment = new NetexEntitiesTestFactory(); BiFunction stopPoint = ( journeyPatternId,