/**
  * @return \Illuminate\Http\JsonResponse
  */
 public function create()
 {
     $validator = (new ReservationValidorBuilder())->create(Input::all());
     if ($validator->fails()) {
         return $this->responseValidationError($validator->messages());
     }
     $reservation = $this->service->book($this->getUser(), Input::all());
     return $this->responseCreated($reservation);
 }
 /**
  * @test
  */
 public function book_not_enough_book_inventory()
 {
     $user = User::find(1);
     $inputs = ['asin' => 'asin2', 'quantity' => 4];
     try {
         $this->sut->book($user, $inputs);
         $this->fail();
     } catch (PreconditionException $e) {
         $this->assertSame('not_enough_book_inventory', $e->getMessage());
     }
 }