-
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.
Merge pull request #6232 from entur/otp2_npe_situation_url
Return empty list if there is no siriUrls in situations/infoLinks
- Loading branch information
Showing
7 changed files
with
89 additions
and
31 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
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
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
9 changes: 6 additions & 3 deletions
9
application/src/main/java/org/opentripplanner/routing/alertpatch/AlertUrl.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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package org.opentripplanner.routing.alertpatch; | ||
|
||
public class AlertUrl { | ||
import java.util.Objects; | ||
import javax.annotation.Nullable; | ||
|
||
public String uri; | ||
public String label; | ||
public record AlertUrl(String uri, @Nullable String label) { | ||
public AlertUrl { | ||
Objects.requireNonNull(uri); | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
application/src/test/java/org/opentripplanner/framework/i18n/I18NStringTest.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,32 @@ | ||
package org.opentripplanner.framework.i18n; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class I18NStringTest { | ||
|
||
private final I18NString noValue = I18NString.of(" \t\n\r\f"); | ||
private final I18NString hasValue = I18NString.of("A value"); | ||
|
||
@Test | ||
void hasValue() { | ||
assertTrue(I18NString.hasValue(hasValue)); | ||
assertFalse(I18NString.hasValue(noValue)); | ||
} | ||
|
||
@Test | ||
void hasNoValue() { | ||
assertFalse(I18NString.hasNoValue(hasValue)); | ||
assertTrue(I18NString.hasNoValue(noValue)); | ||
} | ||
|
||
@Test | ||
void assertHasValue() { | ||
var ex = assertThrows(IllegalArgumentException.class, () -> I18NString.assertHasValue(noValue)); | ||
assertEquals("Value can not be null, empty or just whitespace: ' \t\n\r\f'", ex.getMessage()); | ||
} | ||
} |
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