mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 16:20:34 +00:00
SuggestLocationsResult: Assert for OK status in getLocations().
This commit is contained in:
parent
907d7f5ad6
commit
4e9ff4d9da
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright the original author or authors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,6 +18,7 @@
|
|||
package de.schildbach.pte.dto;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -57,10 +58,10 @@ public final class SuggestLocationsResult implements Serializable {
|
|||
}
|
||||
|
||||
public List<Location> getLocations() {
|
||||
checkState(status == Status.OK, "no locations with status: {}", status);
|
||||
final List<Location> locations = new ArrayList<>(suggestedLocations.size());
|
||||
for (final SuggestedLocation location : suggestedLocations)
|
||||
locations.add(location.location);
|
||||
|
||||
return locations;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue