@ -138,6 +138,15 @@ public class ProjectGenerationRequestTests {
this . request . generateUrl ( metadata ) ) ;
}
@Test
public void typeAndBuildAndFormat ( ) {
InitializrServiceMetadata metadata = readMetadata ( ) ;
setBuildAndFormat ( "gradle" , "project" ) ;
request . setType ( "maven-build" ) ;
assertEquals ( createUrl ( "/pom.xml?type=maven-build" ) ,
this . request . generateUrl ( metadata ) ) ;
}
@Test
public void invalidType ( ) throws URISyntaxException {
this . request . setType ( "does-not-exist" ) ;
@ -152,16 +161,19 @@ public class ProjectGenerationRequestTests {
this . request . generateUrl ( readMetadata ( "types-conflict" ) ) ;
}
private static URI create DefaultUrl( String p aram) {
private static URI create Url( String actionAndP aram) {
try {
return new URI ( ProjectGenerationRequest . DEFAULT_SERVICE_URL + "/starter.zip"
+ param ) ;
return new URI ( ProjectGenerationRequest . DEFAULT_SERVICE_URL + actionAndParam ) ;
}
catch ( URISyntaxException ex ) {
throw new IllegalStateException ( ex ) ;
}
}
private static URI createDefaultUrl ( String param ) {
return createUrl ( "/starter.zip" + param ) ;
}
public void setBuildAndFormat ( String build , String format ) {
this . request . setBuild ( build ! = null ? build : "maven" ) ;
this . request . setFormat ( format ! = null ? format : "project" ) ;