Swagger API-Client, generiert von Codegen-Tool, erstellt nur Testmethoden mit Rückgabetyp void. Wie kann ich meine Ruhe api testen?Swagger API Client-Methoden geben void zurück
Dies ist mein Service-Code-Spezifikation:
@Api(value = "Authentication Recovery")
@Path("/authenticationRecovery")
public class AuthenticationRecoveryResource implements Authentication{
@ApiOperation(
value = "Recover access token"
, notes = "Recover access token assigned to the user (once it has been authenticated)"
, response = TokenJAXB.class
//, responseContainer = "List"
)
@ApiResponses(value = {
@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Authorized access") ,
@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized access")
})
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response authenticate(
@ApiParam(value="Username", required=true) @FormParam("username") String username,
@ApiParam(value="Password", required=true) @FormParam("password") String password)
{..}
Und das ist mein erzeugt Prahlerei Code zum Testen:
/**
* API tests for AuthenticationRecoveryApi
*/
@Ignore
public class AuthenticationRecoveryApiTest {
private final AuthenticationRecoveryApi api = new AuthenticationRecoveryApi();
/**
* Recover access token
*
* Recover access token assigned to the user (once it has been authenticated)
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void authenticateTest() throws ApiException {
String username = null;
String password = null;
api.authenticate(username, password);
// TODO: test validations
}}
ich eine Prahlerei Client api generieren mit:
java -jar swagger-codegen-2.2.3/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i http://localhost:8080/myproject/services/service0/swagger.json -l java -o client/myproject/java
Können Sie Ihre Spezifikation veröffentlichen? Welche Sprache/Framework hast du erstellt? – Helen