Issue-7438 Fix that prevents generating interfaces when interfaceOnly is false. (#7439)

This commit is contained in:
jarlesat 2018-01-22 08:57:17 +01:00 committed by William Cheng
parent 9e1bbe0c1c
commit 5ea3d3bb18
2 changed files with 17 additions and 0 deletions

View File

@ -85,6 +85,9 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
}
if (additionalProperties.containsKey(INTERFACE_ONLY)) {
interfaceOnly = Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString());
if (!interfaceOnly) {
additionalProperties.remove(INTERFACE_ONLY);
}
}
if (interfaceOnly) {
// Change default artifactId if genereating interfaces only, before command line options are applied in base class.

View File

@ -74,4 +74,18 @@ public class JavaJAXRSSpecServerCodegenTest {
}
Assert.fail("Missing " + JavaJAXRSSpecServerCodegen.INTERFACE_ONLY);
}
@Test
public void verify_that_interfaceOnly_is_removed_from_additional_properties_if_false() {
generator.additionalProperties().put(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY, Boolean.FALSE.toString());
generator.processOpts();
Assert.assertFalse(generator.additionalProperties().containsKey(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY));
}
@Test
public void verify_that_interfaceOnly_is_preserved_in_additional_properties_if_true() {
generator.additionalProperties().put(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY, Boolean.TRUE.toString());
generator.processOpts();
Assert.assertTrue(generator.additionalProperties().containsKey(JavaJAXRSSpecServerCodegen.INTERFACE_ONLY));
}
}