Skip to content

Commit

Permalink
formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
qcdyx committed Aug 30, 2024
1 parent 02e7713 commit 0377dae
Showing 1 changed file with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
package org.mobilitydata.gtfsvalidator.validator;

import static com.google.common.truth.Truth.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mobilitydata.gtfsvalidator.notice.NoticeContainer;
import org.mobilitydata.gtfsvalidator.table.GtfsPathway;
import org.mobilitydata.gtfsvalidator.table.GtfsPathwayIsBidirectional;


import static com.google.common.truth.Truth.assertThat;

@RunWith(JUnit4.class)
public class BidirectionalExitGateValidatorTest {
public static GtfsPathway createPathway(int csvRowNumber, Integer pathwayMode, GtfsPathwayIsBidirectional gtfsPathwayIsBidirectional) {
public static GtfsPathway createPathway(
int csvRowNumber,
Integer pathwayMode,
GtfsPathwayIsBidirectional gtfsPathwayIsBidirectional) {
return new GtfsPathway.Builder()
.setCsvRowNumber(csvRowNumber)
.setPathwayMode(pathwayMode)
.setIsBidirectional(gtfsPathwayIsBidirectional)
.build();
.setCsvRowNumber(csvRowNumber)
.setPathwayMode(pathwayMode)
.setIsBidirectional(gtfsPathwayIsBidirectional)
.build();
}

/**
* Tests that a pathway with bidirectional exit gates generates a notice.
*/
/** Tests that a pathway with bidirectional exit gates generates a notice. */
@Test
public void isBidirectionalExitGateShouldGenerateNotice() {
GtfsPathway entity = createPathway(1, 7, GtfsPathwayIsBidirectional.BIDIRECTIONAL);
NoticeContainer noticeContainer = new NoticeContainer();
new BidirectionalExitGateValidator()
.validate(entity, noticeContainer);
assertThat(noticeContainer.getValidationNotices()).containsExactly(
new BidirectionalExitGateValidator.BidirectionalExitGatesNotice(entity));
new BidirectionalExitGateValidator().validate(entity, noticeContainer);
assertThat(noticeContainer.getValidationNotices())
.containsExactly(new BidirectionalExitGateValidator.BidirectionalExitGatesNotice(entity));
}

@Test
public void isNotBidirectionalExitGateShouldNotGenerateNotice() {
GtfsPathway entity = createPathway(1, 7, GtfsPathwayIsBidirectional.UNIDIRECTIONAL);
NoticeContainer noticeContainer = new NoticeContainer();
new BidirectionalExitGateValidator()
.validate(entity, noticeContainer);
new BidirectionalExitGateValidator().validate(entity, noticeContainer);
assertThat(noticeContainer.getValidationNotices()).isEmpty();
}
}

0 comments on commit 0377dae

Please sign in to comment.