-
Notifications
You must be signed in to change notification settings - Fork 1
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 #21 from olech2412/19-implement-journeys
new version 2.2.1 with bug fixes -> take a look at release-changes.md
- Loading branch information
Showing
17 changed files
with
807 additions
and
19 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
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
7 changes: 7 additions & 0 deletions
7
src/main/java/de/olech2412/adapter/dbadapter/model/journey/sub/Location.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
7 changes: 7 additions & 0 deletions
7
src/main/java/de/olech2412/adapter/dbadapter/model/journey/sub/Price.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
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
48 changes: 48 additions & 0 deletions
48
src/test/java/de/olech2412/adapter/dbadapter/exception/ErrorTest.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,48 @@ | ||
package de.olech2412.adapter.dbadapter.exception; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class ErrorTest { | ||
|
||
@Test | ||
void creatingErrorShouldSetMessageAndCode() { | ||
String message = "Error Message"; | ||
int code = 404; | ||
Error error = new Error() { | ||
@Override | ||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
@Override | ||
public int getCode() { | ||
return code; | ||
} | ||
}; | ||
|
||
assertEquals(message, error.getMessage()); | ||
assertEquals(code, error.getCode()); | ||
} | ||
|
||
@Test | ||
void getErrorShouldReturnFormattedErrorMessage() { | ||
String message = "Error Message"; | ||
int code = 404; | ||
Error error = new Error() { | ||
@Override | ||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
@Override | ||
public int getCode() { | ||
return code; | ||
} | ||
}; | ||
|
||
String expected = "404: Error Message"; | ||
assertEquals(expected, error.getError()); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/test/java/de/olech2412/adapter/dbadapter/model/journey/JourneyTest.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,72 @@ | ||
package de.olech2412.adapter.dbadapter.model.journey; | ||
|
||
import de.olech2412.adapter.dbadapter.model.journey.sub.Leg; | ||
import de.olech2412.adapter.dbadapter.model.journey.sub.Price; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Collections; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
public class JourneyTest { | ||
private Journey journey; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
journey = new Journey(); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetType() { | ||
String expectedType = "TestType"; | ||
journey.setType(expectedType); | ||
assertEquals(expectedType, journey.getType()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetTypeWhenTypeIsNull() { | ||
journey.setType(null); | ||
assertNull(journey.getType()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetLegs() { | ||
Leg expectedLeg = new Leg(); | ||
journey.setLegs(Collections.singletonList(expectedLeg)); | ||
assertEquals(Collections.singletonList(expectedLeg), journey.getLegs()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetLegsWhenLegsIsNull() { | ||
journey.setLegs(null); | ||
assertNull(journey.getLegs()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetRefreshToken() { | ||
String expectedRefreshToken = "TestRefreshToken"; | ||
journey.setRefreshToken(expectedRefreshToken); | ||
assertEquals(expectedRefreshToken, journey.getRefreshToken()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetRefreshTokenWhenRefreshTokenIsNull() { | ||
journey.setRefreshToken(null); | ||
assertNull(journey.getRefreshToken()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetPrice() { | ||
Price expectedPrice = new Price(); | ||
journey.setPrice(expectedPrice); | ||
assertEquals(expectedPrice, journey.getPrice()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetPriceWhenPriceIsNull() { | ||
journey.setPrice(null); | ||
assertNull(journey.getPrice()); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/test/java/de/olech2412/adapter/dbadapter/model/journey/sub/FeatureTest.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,55 @@ | ||
package de.olech2412.adapter.dbadapter.model.journey.sub; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
public class FeatureTest { | ||
private Feature feature; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
feature = new Feature(); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetType() { | ||
String expectedType = "TestType"; | ||
feature.setType(expectedType); | ||
assertEquals(expectedType, feature.getType()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetTypeWhenTypeIsNull() { | ||
feature.setType(null); | ||
assertNull(feature.getType()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetProperties() { | ||
Properties expectedProperties = new Properties(); | ||
feature.setProperties(expectedProperties); | ||
assertEquals(expectedProperties, feature.getProperties()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetPropertiesWhenPropertiesIsNull() { | ||
feature.setProperties(null); | ||
assertNull(feature.getProperties()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetGeometry() { | ||
Geometry expectedGeometry = new Geometry(); | ||
feature.setGeometry(expectedGeometry); | ||
assertEquals(expectedGeometry, feature.getGeometry()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetGeometryWhenGeometryIsNull() { | ||
feature.setGeometry(null); | ||
assertNull(feature.getGeometry()); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/test/java/de/olech2412/adapter/dbadapter/model/journey/sub/GeometryTest.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,51 @@ | ||
package de.olech2412.adapter.dbadapter.model.journey.sub; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class GeometryTest { | ||
private Geometry geometry; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
geometry = new Geometry(); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetType() { | ||
String expectedType = "Point"; | ||
geometry.setType(expectedType); | ||
assertEquals(expectedType, geometry.getType()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetTypeWhenTypeIsNull() { | ||
geometry.setType(null); | ||
assertNull(geometry.getType()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetCoordinates() { | ||
List<Double> expectedCoordinates = Arrays.asList(1.0, 2.0); | ||
geometry.setCoordinates(expectedCoordinates); | ||
assertEquals(expectedCoordinates, geometry.getCoordinates()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetCoordinatesWhenCoordinatesIsNull() { | ||
geometry.setCoordinates(null); | ||
assertNull(geometry.getCoordinates()); | ||
} | ||
|
||
@Test | ||
void shouldSetAndGetCoordinatesWhenCoordinatesIsEmpty() { | ||
geometry.setCoordinates(new ArrayList<>()); | ||
assertTrue(geometry.getCoordinates().isEmpty()); | ||
} | ||
} |
Oops, something went wrong.