#96 - Polishing.
Fix ReleaseCommandsIntegrationTests. Guard TrainIterationConverter against invalid input.
This commit is contained in:
@@ -49,6 +49,11 @@ public class TrainIterationConverter implements Converter<TrainIteration> {
|
|||||||
public TrainIteration convertFromText(String value, Class<?> targetType, String optionContext) {
|
public TrainIteration convertFromText(String value, Class<?> targetType, String optionContext) {
|
||||||
|
|
||||||
String[] parts = value.split(" ");
|
String[] parts = value.split(" ");
|
||||||
|
|
||||||
|
if (parts.length != 2) {
|
||||||
|
throw new IllegalArgumentException(String.format("Cannot resolve TrainIteration from '%s'", value));
|
||||||
|
}
|
||||||
|
|
||||||
Train train = ReleaseTrains.getTrainByName(parts[0].trim());
|
Train train = ReleaseTrains.getTrainByName(parts[0].trim());
|
||||||
Iteration iteration = train.getIteration(parts[1].trim());
|
Iteration iteration = train.getIteration(parts[1].trim());
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ public class ReleaseCommandsIntegrationTests extends AbstractIntegrationTests {
|
|||||||
@Test
|
@Test
|
||||||
public void predictsReleaseTrainCorrectly() throws Exception {
|
public void predictsReleaseTrainCorrectly() throws Exception {
|
||||||
|
|
||||||
git.update(ReleaseTrains.GOSLING);
|
git.update(ReleaseTrains.MOORE);
|
||||||
|
|
||||||
assertThat(releaseCommands.predictTrainAndIteration(), is("Gosling"));
|
assertThat(releaseCommands.predictTrainAndIteration(), is("Moore"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user