func CreateBottleBadRequest(t goatest.TInterface, ctx context.Context, service *goa.Service, ctrl app.BottleController, accountID int, payload *app.CreateBottlePayload) (http.ResponseWriter, error) {
	var (
		logBuf bytes.Buffer
		resp   interface{}
		respSetter goatest.ResponseSetterFunc = func(r interface{}) { resp = r }
	)
	if service == nil {
		service = goatest.Service(&logBuf, respSetter)
	} else {
		logger := log.New(&logBuf, "", log.Ltime)
		service.WithLogger(goa.NewLogger(logger))
		newEncoder := func(io.Writer) goa.Encoder { return respSetter }
		service.Encoder = goa.NewHTTPEncoder()  
		service.Encoder.Register(newEncoder, "*/*")
	}
	err := payload.Validate()
	if err != nil {
		e, ok := err.(goa.ServiceError)
		if !ok {
			panic(err)  
		}
		return nil, e
	}
	rw := httptest.NewRecorder()
	u := &url.URL{
		Path: fmt.Sprintf("/cellar/accounts/%v/bottles", accountID),
	}
	req, _err := http.NewRequest("POST", u.String(), nil)
	if _err != nil {
		panic("invalid test " + _err.Error())  
	}
	prms := url.Values{}
	prms["accountID"] = []string{fmt.Sprintf("%v", accountID)}
	if ctx == nil {
		ctx = context.Background()
	}
	goaCtx := goa.NewContext(goa.WithAction(ctx, "BottleTest"), rw, req, prms)
	createCtx, __err := app.NewCreateBottleContext(goaCtx, req, service)
	if __err != nil {
		_e, _ok := __err.(goa.ServiceError)
		if !_ok {
			panic("invalid test data " + __err.Error())  
		}
		return nil, _e
	}
	createCtx.Payload = payload
	__err = ctrl.Create(createCtx)
	if __err != nil {
		t.Fatalf("controller returned %+v, logs:\n%s", __err, logBuf.String())
	}
	if rw.Code != 400 {
		t.Errorf("invalid response status code: got %+v, expected 400", rw.Code)
	}
	var mt error
	if resp != nil {
		var __ok bool
		mt, __ok = resp.(error)
		if !__ok {
			t.Fatalf("invalid response media: got variable of type %T, value %+v, expected instance of error", resp, resp)
		}
	}
	return rw, mt
}
CreateBottleBadRequest runs the method Create of the given controller with the given parameters and payload.
It returns the response writer so it's possible to inspect the response headers and the media type struct written to the response.
If ctx is nil then context.Background() is used.
If service is nil then a default service is created.
package test
import (
	"bytes"
	"context"
	"fmt"
	"github.com/goadesign/goa"
	"github.com/goadesign/goa-cellar/app"
	"github.com/goadesign/goa/goatest"
	"io"
	"log"
	"net/http"
	"net/http/httptest"
	"net/url"
)