BotEvaluation / MensaService

0 stars 0 forks source link

[API Test]: PostSucceeds #16

Open BobCAE opened 2 years ago

BobCAE commented 2 years ago

Request method

POST

Request Path

/dishes/1/ratings

Request Body

{
"comment": "Super!", 
"stars": 4
}

Expected Status Code

201 (Created)

Response Body Assertions

api-testing-bot[bot] commented 2 years ago

Here is the generated test method code:

  public void testCase() {
    MiniClient c = new MiniClient(mainPath);
    c.setConnectorEndpoint(connector.getHttpEndpoint());

    try {
      c.setLogin(AnonymousAgentImpl.IDENTIFIER, "");
      ClientResponse result = c.sendRequest("POST", "/dishes/{id}/ratings", """
{
"comment": "Super!", 
"stars": 4
}
""", "application/json", "*/*", new HashMap<>(), "null");

      Assert.assertEquals(201, result.getHttpCode());

    } catch (Exception e) {
      e.printStackTrace();
      fail("Exception: " + e);
    }

  }