@Test public void addMovie() { final WebTarget target = ClientBuilder.newClient().target(serverURI); final Movie movie = new Movie("Shanghai Noon", "Tom Dey", "Comedy", 7, 2000); final Movie posted = target.path("/api/movies").request() .post(entity(movie, MediaType.APPLICATION_JSON)) .readEntity(Movie.class); assertEquals("Tom Dey", posted.getDirector()); assertEquals("Shanghai Noon", posted.getTitle()); assertEquals("Comedy", posted.getGenre()); assertEquals(2000, posted.getYear()); assertEquals(7, posted.getId()); }
@POST public Movie addMovie(final Movie newMovie) { store.put(newMovie.getId(), newMovie); return newMovie; }
MovieService { @POST public Movie addMovie(final Movie newMovie) { store.put(newMovie.getId(), newMovie); return newMovie; } }
MovieService { @POST public Movie addMovie(final Movie newMovie) { store.put(newMovie.getId(), newMovie); return newMovie; }  }
MovieService { @POST public Movie addMovie(final Movie newMovie) { store.put(newMovie.getId(), newMovie); return newMovie; }  @PostConstruct void construct(); @GET List<Movie> getAllMovies(); @POST Movie addMovie(final Movie newMovie); }
MovieService { @POST public Movie addMovie(final Movie newMovie) { store.put(newMovie.getId(), newMovie); return newMovie; }  @PostConstruct void construct(); @GET List<Movie> getAllMovies(); @POST Movie addMovie(final Movie newMovie);  }