Added testCase for List All Movies and Add a Movie

This commit is contained in:
Giuseppe Bueti
2016-01-30 20:39:28 +01:00
parent 4b5ad0629a
commit 663def8e2c
8 changed files with 184 additions and 31 deletions
@@ -1,15 +1,13 @@
package com.baeldung.client;
import com.baeldung.Movie;
import com.baeldung.model.Movie;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Path("/movies")
public interface ServicesInterface {
@@ -1,5 +1,5 @@
package com.baeldung;
package com.baeldung.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -532,4 +532,47 @@ public class Movie {
this.year = value;
}
@Override
public String toString() {
return "Movie{" +
"actors='" + actors + '\'' +
", awards='" + awards + '\'' +
", country='" + country + '\'' +
", director='" + director + '\'' +
", genre='" + genre + '\'' +
", imdbID='" + imdbID + '\'' +
", imdbRating='" + imdbRating + '\'' +
", imdbVotes='" + imdbVotes + '\'' +
", language='" + language + '\'' +
", metascore='" + metascore + '\'' +
", poster='" + poster + '\'' +
", rated='" + rated + '\'' +
", released='" + released + '\'' +
", response='" + response + '\'' +
", runtime='" + runtime + '\'' +
", title='" + title + '\'' +
", type='" + type + '\'' +
", writer='" + writer + '\'' +
", year='" + year + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Movie movie = (Movie) o;
if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false;
return title != null ? title.equals(movie.title) : movie.title == null;
}
@Override
public int hashCode() {
int result = imdbID != null ? imdbID.hashCode() : 0;
result = 31 * result + (title != null ? title.hashCode() : 0);
return result;
}
}
@@ -1,11 +1,10 @@
package com.baeldung.server.service;
package com.baeldung.server;
import com.baeldung.Movie;
import com.baeldung.model.Movie;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -1,4 +1,4 @@
package com.baeldung.server.service;
package com.baeldung.server;
import javax.ws.rs.ApplicationPath;