Package models

Examples of models.Beer


                           .expect()
                           .statusCode(200)
                           .when()
                           .post("/");

                Beer beer = RestAssured.expect()
                                       .statusCode(200)
                                       .when()
                                       .get("/Westmalle")
                                       .andReturn()
                                       .body()
View Full Code Here


        running(testServer(PORT), new Runnable()
        {
            @Override
            public void run()
            {
                Beer beer = RestAssured.given()
                                       .contentType(ContentType.JSON)
                                       .content("{\"name\":\"Westmale\"}")
                                       .expect()
                                       .statusCode(200)
                                       .when()
View Full Code Here

        return ok(Json.toJson(Beer.getAll()));
    }

    public static Result get(String name)
    {
        Beer beer = Beer.getByName(name);
        Result result;

        if (beer == null)
        {
            result = notFound();
View Full Code Here

    @BodyParser.Of(BodyParser.Json.class)
    public static Result create()
    {
        JsonNode json = request().body().asJson();
        Beer beer = Json.fromJson(json, Beer.class);

        beer.save();

        return ok(Json.toJson(beer));

    }
View Full Code Here

    @BodyParser.Of(BodyParser.Json.class)
    public static Result update(String name)
    {
        JsonNode json = request().body().asJson();
        Beer beer = Json.fromJson(json, Beer.class);

        beer.update();

        return ok(Json.toJson(beer));
    }
View Full Code Here

        return ok(Json.toJson(beer));
    }

    public static Result delete(String name)
    {
        Beer beer = Beer.getByName(name);
        Result result;

        if (beer == null)
        {
            result = notFound();
        }
        else
        {
            beer.delete();
            result = noContent();
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of models.Beer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.