Added Last Movie test

This commit is contained in:
Omertron
2012-01-30 12:10:29 +00:00
parent 9c7b339761
commit 20422642d0
6 changed files with 1531 additions and 1521 deletions
File diff suppressed because it is too large Load Diff
@@ -1,173 +1,167 @@
/* /*
* Copyright (c) 2004-2012 YAMJ Members * Copyright (c) 2004-2012 YAMJ Members
* http://code.google.com/p/moviejukebox/people/list * http://code.google.com/p/moviejukebox/people/list
* *
* Web: http://code.google.com/p/moviejukebox/ * Web: http://code.google.com/p/moviejukebox/
* *
* This software is licensed under a Creative Commons License * This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License * See this page: http://code.google.com/p/moviejukebox/wiki/License
* *
* For any reuse or distribution, you must make clear to others the * For any reuse or distribution, you must make clear to others the
* license terms of this work. * license terms of this work.
*/ */
package com.moviejukebox.themoviedb.model; package com.moviejukebox.themoviedb.model;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.codehaus.jackson.annotate.JsonAnySetter; import org.codehaus.jackson.annotate.JsonAnySetter;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName; import org.codehaus.jackson.map.annotate.JsonRootName;
/** /**
* *
* @author stuart.boston * @author stuart.boston
*/ */
@JsonRootName("collection") @JsonRootName("collection")
public class Collection { public class Collection {
/* /*
* Logger * Logger
*/ */
private static final Logger LOGGER = Logger.getLogger(Collection.class); private static final Logger LOGGER = Logger.getLogger(Collection.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@JsonProperty("title") @JsonProperty("title")
private String title; private String title;
@JsonProperty("name") @JsonProperty("name")
private String name; private String name;
@JsonProperty("poster_path") @JsonProperty("poster_path")
private String posterPath; private String posterPath;
@JsonProperty("backdrop_path") @JsonProperty("backdrop_path")
private String backdropPath; private String backdropPath;
@JsonProperty("release_date") @JsonProperty("release_date")
private String releaseDate; private String releaseDate;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> //<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getBackdropPath() { public String getBackdropPath() {
return backdropPath; return backdropPath;
} }
public int getId() { public int getId() {
return id; return id;
} }
public String getPosterPath() { public String getPosterPath() {
return posterPath; return posterPath;
} }
public String getReleaseDate() { public String getReleaseDate() {
return releaseDate; return releaseDate;
} }
public String getTitle() { public String getTitle() {
if (StringUtils.isBlank(title)) { if (StringUtils.isBlank(title)) {
return name; return name;
} }
return title; return title;
} }
public String getName() { public String getName() {
if (StringUtils.isBlank(name)) { if (StringUtils.isBlank(name)) {
return title; return title;
} }
return name; return name;
} }
//</editor-fold> //</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods"> //<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setBackdropPath(String backdropPath) { public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath; this.backdropPath = backdropPath;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
public void setPosterPath(String posterPath) { public void setPosterPath(String posterPath) {
this.posterPath = posterPath; this.posterPath = posterPath;
} }
public void setReleaseDate(String releaseDate) { public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate; this.releaseDate = releaseDate;
} }
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
//</editor-fold> //</editor-fold>
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
* @param key * @param key
* @param value * @param value
*/ */
@JsonAnySetter @JsonAnySetter
public void handleUnknown(String key, Object value) { public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
LOGGER.warn(sb.toString()); LOGGER.warn(sb.toString());
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
final Collection other = (Collection) obj; final Collection other = (Collection) obj;
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) { if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
return false; return false;
} }
if (this.id != other.id) { if (this.id != other.id) {
return false; return false;
} }
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) { if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
return false; return false;
} }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false; return false;
} }
if ((this.posterPath == null) ? (other.posterPath != null) : !this.posterPath.equals(other.posterPath)) { return true;
return false; }
}
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) { @Override
return false; public int hashCode() {
} int hash = 7;
return true; hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
} hash = 19 * hash + this.id;
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
@Override hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
public int hashCode() { hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
int hash = 7; hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0); return hash;
hash = 19 * hash + this.id; }
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0); @Override
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0); public String toString() {
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0); StringBuilder sb = new StringBuilder("[Collection=");
return hash; sb.append("[id=").append(id);
} sb.append("],[title=").append(title);
sb.append("],[name=").append(name);
@Override sb.append("],[posterPath=").append(posterPath);
public String toString() { sb.append("],[backdropPath=").append(backdropPath);
StringBuilder sb = new StringBuilder("[Collection="); sb.append("],[releaseDate=").append(releaseDate);
sb.append("[id=").append(id); sb.append("]]");
sb.append("],[title=").append(title); return sb.toString();
sb.append("],[name=").append(name); }
sb.append("],[posterPath=").append(posterPath); }
sb.append("],[backdropPath=").append(backdropPath);
sb.append("],[releaseDate=").append(releaseDate);
sb.append("]]");
return sb.toString();
}
}
@@ -1,149 +1,146 @@
/* /*
* Copyright (c) 2004-2012 YAMJ Members * Copyright (c) 2004-2012 YAMJ Members
* http://code.google.com/p/moviejukebox/people/list * http://code.google.com/p/moviejukebox/people/list
* *
* Web: http://code.google.com/p/moviejukebox/ * Web: http://code.google.com/p/moviejukebox/
* *
* This software is licensed under a Creative Commons License * This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License * See this page: http://code.google.com/p/moviejukebox/wiki/License
* *
* For any reuse or distribution, you must make clear to others the * For any reuse or distribution, you must make clear to others the
* license terms of this work. * license terms of this work.
*/ */
package com.moviejukebox.themoviedb.model; package com.moviejukebox.themoviedb.model;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.codehaus.jackson.annotate.JsonAnySetter; import org.codehaus.jackson.annotate.JsonAnySetter;
import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonProperty;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class PersonCrew { public class PersonCrew {
/* /*
* Logger * Logger
*/ */
private static final Logger LOGGER = Logger.getLogger(PersonCrew.class); private static final Logger LOGGER = Logger.getLogger(PersonCrew.class);
/* /*
* Properties * Properties
*/ */
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@JsonProperty("department") @JsonProperty("department")
private String department; private String department;
@JsonProperty("job") @JsonProperty("job")
private String job; private String job;
@JsonProperty("name") @JsonProperty("name")
private String name; private String name;
@JsonProperty("profile_path") @JsonProperty("profile_path")
private String profilePath; private String profilePath;
//<editor-fold defaultstate="collapsed" desc="Getter methods"> //<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getDepartment() { public String getDepartment() {
return department; return department;
} }
public int getId() { public int getId() {
return id; return id;
} }
public String getJob() { public String getJob() {
return job; return job;
} }
public String getName() { public String getName() {
return name; return name;
} }
public String getProfilePath() { public String getProfilePath() {
return profilePath; return profilePath;
} }
//</editor-fold> //</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods"> //<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setDepartment(String department) { public void setDepartment(String department) {
this.department = department; this.department = department;
} }
public void setId(int id) { public void setId(int id) {
this.id = id; this.id = id;
} }
public void setJob(String job) { public void setJob(String job) {
this.job = job; this.job = job;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public void setProfilePath(String profilePath) { public void setProfilePath(String profilePath) {
this.profilePath = profilePath; this.profilePath = profilePath;
} }
//</editor-fold> //</editor-fold>
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
* @param key * @param key
* @param value * @param value
*/ */
@JsonAnySetter @JsonAnySetter
public void handleUnknown(String key, Object value) { public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
LOGGER.warn(sb.toString()); LOGGER.warn(sb.toString());
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
final PersonCrew other = (PersonCrew) obj; final PersonCrew other = (PersonCrew) obj;
if (this.id != other.id) { if (this.id != other.id) {
return false; return false;
} }
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) { if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
return false; return false;
} }
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) { if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
return false; return false;
} }
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false; return false;
} }
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) { return true;
return false; }
}
return true; @Override
} public int hashCode() {
int hash = 7;
@Override hash = 59 * hash + this.id;
public int hashCode() { hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
int hash = 7; hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
hash = 59 * hash + this.id; hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0); hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0); return hash;
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0); }
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
return hash; @Override
} public String toString() {
StringBuilder sb = new StringBuilder("[PersonCrew=");
@Override sb.append("id=").append(id);
public String toString() { sb.append("],[department=").append(department);
StringBuilder sb = new StringBuilder("[PersonCrew="); sb.append("],[job=").append(job);
sb.append("id=").append(id); sb.append("],[name=").append(name);
sb.append("],[department=").append(department); sb.append("],[profilePath=").append(profilePath);
sb.append("],[job=").append(job); sb.append("]]");
sb.append("],[name=").append(name); return sb.toString();
sb.append("],[profilePath=").append(profilePath); }
sb.append("]]"); }
return sb.toString();
}
}
@@ -1,134 +1,131 @@
/* /*
* Copyright (c) 2004-2012 YAMJ Members * Copyright (c) 2004-2012 YAMJ Members
* http://code.google.com/p/moviejukebox/people/list * http://code.google.com/p/moviejukebox/people/list
* *
* Web: http://code.google.com/p/moviejukebox/ * Web: http://code.google.com/p/moviejukebox/
* *
* This software is licensed under a Creative Commons License * This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License * See this page: http://code.google.com/p/moviejukebox/wiki/License
* *
* For any reuse or distribution, you must make clear to others the * For any reuse or distribution, you must make clear to others the
* license terms of this work. * license terms of this work.
*/ */
package com.moviejukebox.themoviedb.model; package com.moviejukebox.themoviedb.model;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.codehaus.jackson.annotate.JsonAnySetter; import org.codehaus.jackson.annotate.JsonAnySetter;
/** /**
* *
* @author Stuart * @author Stuart
*/ */
public class Trailer { public class Trailer {
/* /*
* Logger * Logger
*/ */
private static final Logger LOGGER = Logger.getLogger(Trailer.class); private static final Logger LOGGER = Logger.getLogger(Trailer.class);
/* /*
* Website sources * Website sources
*/ */
public static final String WEBSITE_YOUTUBE = "youtube"; public static final String WEBSITE_YOUTUBE = "youtube";
public static final String WEBSITE_QUICKTIME = "quicktime"; public static final String WEBSITE_QUICKTIME = "quicktime";
/* /*
* Properties * Properties
*/ */
private String name; private String name;
private String size; private String size;
private String source; private String source;
private String website; // The website of the trailer private String website; // The website of the trailer
//<editor-fold defaultstate="collapsed" desc="Getter methods"> //<editor-fold defaultstate="collapsed" desc="Getter methods">
public String getName() { public String getName() {
return name; return name;
} }
public String getSize() { public String getSize() {
return size; return size;
} }
public String getSource() { public String getSource() {
return source; return source;
} }
public String getWebsite() { public String getWebsite() {
return website; return website;
} }
//</editor-fold> //</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Setter methods"> //<editor-fold defaultstate="collapsed" desc="Setter methods">
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public void setSize(String size) { public void setSize(String size) {
this.size = size; this.size = size;
} }
public void setSource(String source) { public void setSource(String source) {
this.source = source; this.source = source;
} }
public void setWebsite(String website) { public void setWebsite(String website) {
this.website = website; this.website = website;
} }
//</editor-fold> //</editor-fold>
/** /**
* Handle unknown properties and print a message * Handle unknown properties and print a message
* @param key * @param key
* @param value * @param value
*/ */
@JsonAnySetter @JsonAnySetter
public void handleUnknown(String key, Object value) { public void handleUnknown(String key, Object value) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("Unknown property: '").append(key); sb.append("Unknown property: '").append(key);
sb.append("' value: '").append(value).append("'"); sb.append("' value: '").append(value).append("'");
LOGGER.warn(sb.toString()); LOGGER.warn(sb.toString());
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
final Trailer other = (Trailer) obj; final Trailer other = (Trailer) obj;
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
return false; return false;
} }
if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) { if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) {
return false; return false;
} }
if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) { if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
return false; return false;
} }
if ((this.website == null) ? (other.website != null) : !this.website.equals(other.website)) { return true;
return false; }
}
return true; @Override
} public int hashCode() {
int hash = 7;
@Override hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
public int hashCode() { hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
int hash = 7; hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0); return hash;
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0); }
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
return hash; @Override
} public String toString() {
StringBuilder sb = new StringBuilder("[Trailer=");
@Override sb.append("name=").append(name);
public String toString() { sb.append("],[size=").append(size);
StringBuilder sb = new StringBuilder("[Trailer="); sb.append("],[source=").append(source);
sb.append("name=").append(name); sb.append("],[website=").append(website);
sb.append("],[size=").append(size); sb.append("]]");
sb.append("],[source=").append(source); return sb.toString();
sb.append("],[website=").append(website); }
sb.append("]]"); }
return sb.toString();
}
}
@@ -1,248 +1,248 @@
/* /*
* Copyright (c) 2004-2012 YAMJ Members * Copyright (c) 2004-2012 YAMJ Members
* http://code.google.com/p/moviejukebox/people/list * http://code.google.com/p/moviejukebox/people/list
* *
* Web: http://code.google.com/p/moviejukebox/ * Web: http://code.google.com/p/moviejukebox/
* *
* This software is licensed under a Creative Commons License * This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License * See this page: http://code.google.com/p/moviejukebox/wiki/License
* *
* For any reuse or distribution, you must make clear to others the * For any reuse or distribution, you must make clear to others the
* license terms of this work. * license terms of this work.
*/ */
package com.moviejukebox.themoviedb.tools; package com.moviejukebox.themoviedb.tools;
import com.moviejukebox.themoviedb.TheMovieDb; import com.moviejukebox.themoviedb.TheMovieDb;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* The API URL that is used to construct the API call * The API URL that is used to construct the API call
* *
* @author Stuart * @author Stuart
*/ */
public class ApiUrl { public class ApiUrl {
/* /*
* Logger * Logger
*/ */
private static final Logger LOGGER = Logger.getLogger(ApiUrl.class); private static final Logger LOGGER = Logger.getLogger(ApiUrl.class);
/* /*
* TheMovieDb API Base URL * TheMovieDb API Base URL
*/ */
private final String TMDB_API_BASE = "http://api.themoviedb.org/3/"; private static final String TMDB_API_BASE = "http://api.themoviedb.org/3/";
/* /*
* Parameter configuration * Parameter configuration
*/ */
private static final String DELIMITER_FIRST = "?"; private static final String DELIMITER_FIRST = "?";
private static final String DELIMITER_SUBSEQUENT = "&"; private static final String DELIMITER_SUBSEQUENT = "&";
private static final String PARAMETER_API_KEY = "api_key="; // The API Key is always needed and always first private static final String PARAMETER_API_KEY = "api_key="; // The API Key is always needed and always first
private static final String PARAMETER_QUERY = "query="; private static final String PARAMETER_QUERY = "query=";
private static final String PARAMETER_LANGUAGE = DELIMITER_SUBSEQUENT + "language="; private static final String PARAMETER_LANGUAGE = DELIMITER_SUBSEQUENT + "language=";
private static final String PARAMETER_COUNTRY = DELIMITER_SUBSEQUENT + "country="; private static final String PARAMETER_COUNTRY = DELIMITER_SUBSEQUENT + "country=";
private static final String PARAMETER_PAGE = DELIMITER_SUBSEQUENT + "page="; private static final String PARAMETER_PAGE = DELIMITER_SUBSEQUENT + "page=";
private static final String DEFAULT_STRING = ""; private static final String DEFAULT_STRING = "";
private static final int DEFAULT_INT = -1; private static final int DEFAULT_INT = -1;
/* /*
* Properties * Properties
*/ */
private String method; private String method;
private String submethod; private String submethod;
private TheMovieDb TMDb; private TheMovieDb tmdb;
//<editor-fold defaultstate="collapsed" desc="Constructor Methods"> //<editor-fold defaultstate="collapsed" desc="Constructor Methods">
/** /**
* Constructor for the simple API URL method without a sub-method * Constructor for the simple API URL method without a sub-method
* @param method * @param method
*/ */
public ApiUrl(TheMovieDb TMDb, String method) { public ApiUrl(TheMovieDb tmdb, String method) {
this.TMDb = TMDb; this.tmdb = tmdb;
this.method = method; this.method = method;
this.submethod = DEFAULT_STRING; this.submethod = DEFAULT_STRING;
} }
/** /**
* Constructor for the API URL with a sub-method * Constructor for the API URL with a sub-method
* @param method * @param method
* @param submethod * @param submethod
*/ */
public ApiUrl(TheMovieDb TMDb, String method, String submethod) { public ApiUrl(TheMovieDb tmdb, String method, String submethod) {
this.TMDb = TMDb; this.tmdb = tmdb;
this.method = method; this.method = method;
this.submethod = submethod; this.submethod = submethod;
} }
//</editor-fold> //</editor-fold>
/** /**
* Create the full URL with the API. * Create the full URL with the API.
* *
* @param query * @param query
* @param tmdbId * @param tmdbId
* @param language * @param language
* @param country * @param country
* @param page * @param page
* @return * @return
*/ */
private URL getFullUrl(String query, String movieId, String language, String country, int page) { private URL getFullUrl(String query, String movieId, String language, String country, int page) {
StringBuilder urlString = new StringBuilder(TMDB_API_BASE); StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
// Get the start of the URL // Get the start of the URL
urlString.append(method); urlString.append(method);
// Append the search term if required // Append the search term if required
if (StringUtils.isNotBlank(query)) { if (StringUtils.isNotBlank(query)) {
urlString.append(DELIMITER_FIRST); urlString.append(DELIMITER_FIRST);
urlString.append(PARAMETER_QUERY); urlString.append(PARAMETER_QUERY);
try { try {
urlString.append(URLEncoder.encode(query, "UTF-8")); urlString.append(URLEncoder.encode(query, "UTF-8"));
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
// If we can't encode it, try it raw // If we can't encode it, try it raw
urlString.append(query); urlString.append(query);
} }
} }
// Append the ID if provided // Append the ID if provided
if (StringUtils.isNotBlank(movieId)) { if (StringUtils.isNotBlank(movieId)) {
urlString.append(movieId); urlString.append(movieId);
} }
// Append the suffix of the API URL // Append the suffix of the API URL
urlString.append(submethod); urlString.append(submethod);
// Append the key information // Append the key information
if (StringUtils.isBlank(query)) { if (StringUtils.isBlank(query)) {
// This is the first parameter // This is the first parameter
urlString.append(DELIMITER_FIRST); urlString.append(DELIMITER_FIRST);
} else { } else {
// The first parameter was the query // The first parameter was the query
urlString.append(DELIMITER_SUBSEQUENT); urlString.append(DELIMITER_SUBSEQUENT);
} }
urlString.append(PARAMETER_API_KEY); urlString.append(PARAMETER_API_KEY);
urlString.append(TMDb.getApiKey()); urlString.append(tmdb.getApiKey());
// Append the language to the URL // Append the language to the URL
if (StringUtils.isNotBlank(language)) { if (StringUtils.isNotBlank(language)) {
urlString.append(PARAMETER_LANGUAGE); urlString.append(PARAMETER_LANGUAGE);
urlString.append(language); urlString.append(language);
} }
// Append the country to the URL // Append the country to the URL
if (StringUtils.isNotBlank(country)) { if (StringUtils.isNotBlank(country)) {
urlString.append(PARAMETER_COUNTRY); urlString.append(PARAMETER_COUNTRY);
urlString.append(country); urlString.append(country);
} }
// Append the page to the URL // Append the page to the URL
if (page > DEFAULT_INT) { if (page > DEFAULT_INT) {
urlString.append(PARAMETER_PAGE); urlString.append(PARAMETER_PAGE);
urlString.append(page); urlString.append(page);
} }
try { try {
LOGGER.trace("URL: " + urlString.toString()); LOGGER.trace("URL: " + urlString.toString());
return new URL(urlString.toString()); return new URL(urlString.toString());
} catch (MalformedURLException ex) { } catch (MalformedURLException ex) {
LOGGER.warn("Failed to create URL " + urlString.toString()); LOGGER.warn("Failed to create URL " + urlString.toString());
return null; return null;
} }
} }
/** /**
* Create an URL using the query (string), language and page * Create an URL using the query (string), language and page
* *
* @param query * @param query
* @param language * @param language
* @param page * @param page
* @return * @return
*/ */
public URL getQueryUrl(String query, String language, int page) { public URL getQueryUrl(String query, String language, int page) {
return getFullUrl(query, DEFAULT_STRING, language, null, page); return getFullUrl(query, DEFAULT_STRING, language, null, page);
} }
/** /**
* Create an URL using the query (string) * Create an URL using the query (string)
* @param query * @param query
* @return * @return
*/ */
public URL getQueryUrl(String query) { public URL getQueryUrl(String query) {
return getQueryUrl(query, DEFAULT_STRING, DEFAULT_INT); return getQueryUrl(query, DEFAULT_STRING, DEFAULT_INT);
} }
/** /**
* Create an URL using the query (string) and language * Create an URL using the query (string) and language
* @param query * @param query
* @param language * @param language
* @return * @return
*/ */
public URL getQueryUrl(String query, String language) { public URL getQueryUrl(String query, String language) {
return getQueryUrl(query, language, DEFAULT_INT); return getQueryUrl(query, language, DEFAULT_INT);
} }
/** /**
* Create an URL using the movie ID, language and country code * Create an URL using the movie ID, language and country code
* *
* @param movieId * @param movieId
* @param language * @param language
* @param country * @param country
* @return * @return
*/ */
public URL getIdUrl(String movieId, String language, String country) { public URL getIdUrl(String movieId, String language, String country) {
return getFullUrl(DEFAULT_STRING, movieId, language, country, DEFAULT_INT); return getFullUrl(DEFAULT_STRING, movieId, language, country, DEFAULT_INT);
} }
/** /**
* Create an URL using the movie ID and language * Create an URL using the movie ID and language
* @param movieId * @param movieId
* @param language * @param language
* @return * @return
*/ */
public URL getIdUrl(String movieId, String language) { public URL getIdUrl(String movieId, String language) {
return getIdUrl(movieId, language, DEFAULT_STRING); return getIdUrl(movieId, language, DEFAULT_STRING);
} }
/** /**
* Create an URL using the movie ID * Create an URL using the movie ID
* @param movieId * @param movieId
* @return * @return
*/ */
public URL getIdUrl(String movieId) { public URL getIdUrl(String movieId) {
return getIdUrl(movieId, DEFAULT_STRING, DEFAULT_STRING); return getIdUrl(movieId, DEFAULT_STRING, DEFAULT_STRING);
} }
/** /**
* Create an URL using the movie ID, language and country code * Create an URL using the movie ID, language and country code
* *
* @param movieId * @param movieId
* @param language * @param language
* @param country * @param country
* @return * @return
*/ */
public URL getIdUrl(int movieId, String language, String country) { public URL getIdUrl(int movieId, String language, String country) {
return getIdUrl(String.valueOf(movieId), language, country); return getIdUrl(String.valueOf(movieId), language, country);
} }
/** /**
* Create an URL using the movie ID and language * Create an URL using the movie ID and language
* @param movieId * @param movieId
* @param language * @param language
* @return * @return
*/ */
public URL getIdUrl(int movieId, String language) { public URL getIdUrl(int movieId, String language) {
return getIdUrl(String.valueOf(movieId), language, DEFAULT_STRING); return getIdUrl(String.valueOf(movieId), language, DEFAULT_STRING);
} }
/** /**
* Create an URL using the movie ID * Create an URL using the movie ID
* @param movieId * @param movieId
* @return * @return
*/ */
public URL getIdUrl(int movieId) { public URL getIdUrl(int movieId) {
return getIdUrl(String.valueOf(movieId), DEFAULT_STRING, DEFAULT_STRING); return getIdUrl(String.valueOf(movieId), DEFAULT_STRING, DEFAULT_STRING);
} }
} }
@@ -1,299 +1,317 @@
/* /*
* Copyright (c) 2004-2012 YAMJ Members * Copyright (c) 2004-2012 YAMJ Members
* http://code.google.com/p/moviejukebox/people/list * http://code.google.com/p/moviejukebox/people/list
* *
* Web: http://code.google.com/p/moviejukebox/ * Web: http://code.google.com/p/moviejukebox/
* *
* This software is licensed under a Creative Commons License * This software is licensed under a Creative Commons License
* See this page: http://code.google.com/p/moviejukebox/wiki/License * See this page: http://code.google.com/p/moviejukebox/wiki/License
* *
* For any reuse or distribution, you must make clear to others the * For any reuse or distribution, you must make clear to others the
* license terms of this work. * license terms of this work.
*/ */
package com.moviejukebox.themoviedb; package com.moviejukebox.themoviedb;
import com.moviejukebox.themoviedb.model.*; import com.moviejukebox.themoviedb.model.*;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import org.junit.*; import org.junit.*;
/** /**
* Test cases for TheMovieDb API * Test cases for TheMovieDb API
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class TheMovieDbTest { public class TheMovieDbTest {
private static final Logger LOGGER = Logger.getLogger(TheMovieDbTest.class); private static final Logger LOGGER = Logger.getLogger(TheMovieDbTest.class);
private static final String API_KEY = "5a1a77e2eba8984804586122754f969f"; private static final String API_KEY = "5a1a77e2eba8984804586122754f969f";
private static TheMovieDb tmdb; private static TheMovieDb tmdb;
/* /*
* Test data * Test data
*/ */
private static final int ID_BLADE_RUNNER = 78; private static final int ID_BLADE_RUNNER = 78;
private static final int ID_STAR_WARS_COLLECTION = 10; private static final int ID_STAR_WARS_COLLECTION = 10;
private static final int ID_BRUCE_WILLIS = 62; private static final int ID_BRUCE_WILLIS = 62;
public TheMovieDbTest() throws IOException { public TheMovieDbTest() throws IOException {
tmdb = new TheMovieDb(API_KEY); tmdb = new TheMovieDb(API_KEY);
} }
@BeforeClass @BeforeClass
public static void setUpClass() throws Exception { public static void setUpClass() throws Exception {
} }
@AfterClass @AfterClass
public static void tearDownClass() throws Exception { public static void tearDownClass() throws Exception {
} }
@Before @Before
public void setUp() { public void setUp() {
} }
@After @After
public void tearDown() { public void tearDown() {
} }
/** /**
* Test of getConfiguration method, of class TheMovieDb. * Test of getConfiguration method, of class TheMovieDb.
*/ */
@Test @Test
public void testConfiguration() throws IOException { public void testConfiguration() throws IOException {
LOGGER.info("Test Configuration"); LOGGER.info("Test Configuration");
TmdbConfiguration tmdbConfig = tmdb.getConfiguration(); TmdbConfiguration tmdbConfig = tmdb.getConfiguration();
assertNotNull("Configuration failed", tmdbConfig); assertNotNull("Configuration failed", tmdbConfig);
assertTrue("No base URL", StringUtils.isNotBlank(tmdbConfig.getBaseUrl())); assertTrue("No base URL", StringUtils.isNotBlank(tmdbConfig.getBaseUrl()));
assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0); assertTrue("No backdrop sizes", tmdbConfig.getBackdropSizes().size() > 0);
assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0); assertTrue("No poster sizes", tmdbConfig.getPosterSizes().size() > 0);
assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0); assertTrue("No profile sizes", tmdbConfig.getProfileSizes().size() > 0);
LOGGER.info(tmdbConfig.toString()); LOGGER.info(tmdbConfig.toString());
} }
/** /**
* Test of searchMovie method, of class TheMovieDb. * Test of searchMovie method, of class TheMovieDb.
*/ */
@Test @Test
public void testSearchMovie() throws UnsupportedEncodingException { public void testSearchMovie() throws UnsupportedEncodingException {
LOGGER.info("searchMovie"); LOGGER.info("searchMovie");
// Try a movie with less than 1 page of results // Try a movie with less than 1 page of results
List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", "", true); List<MovieDb> movieList = tmdb.searchMovie("Blade Runner", "", true);
assertTrue("No movies found, should be at least 1", movieList.size() > 0); assertTrue("No movies found, should be at least 1", movieList.size() > 0);
// Try a russian langugage movie // Try a russian langugage movie
movieList = tmdb.searchMovie("О чём говорят мужчины", "ru", true); movieList = tmdb.searchMovie("О чём говорят мужчины", "ru", true);
assertTrue("No movies found, should be at least 1", movieList.size() > 0); assertTrue("No movies found, should be at least 1", movieList.size() > 0);
// Try a movie with more than 20 results // Try a movie with more than 20 results
movieList = tmdb.searchMovie("Star Wars", "en", false); movieList = tmdb.searchMovie("Star Wars", "en", false);
assertTrue("Not enough movies found, should be 20", movieList.size() == 20); assertTrue("Not enough movies found, should be 20", movieList.size() == 20);
} }
/** /**
* Test of getMovieInfo method, of class TheMovieDb. * Test of getMovieInfo method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieInfo() { public void testGetMovieInfo() {
LOGGER.info("getMovieInfo"); LOGGER.info("getMovieInfo");
String language = "en"; String language = "en";
MovieDb result = tmdb.getMovieInfo(ID_BLADE_RUNNER, language); MovieDb result = tmdb.getMovieInfo(ID_BLADE_RUNNER, language);
assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle()); assertEquals("Incorrect movie information", "Blade Runner", result.getOriginalTitle());
} }
/** /**
* Test of getMovieAlternativeTitles method, of class TheMovieDb. * Test of getMovieAlternativeTitles method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieAlternativeTitles() { public void testGetMovieAlternativeTitles() {
LOGGER.info("getMovieAlternativeTitles"); LOGGER.info("getMovieAlternativeTitles");
String country = ""; String country = "";
List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_BLADE_RUNNER, country); List<AlternativeTitle> results = tmdb.getMovieAlternativeTitles(ID_BLADE_RUNNER, country);
assertTrue("No alternative titles found", results.size() > 0); assertTrue("No alternative titles found", results.size() > 0);
country = "US"; country = "US";
results = tmdb.getMovieAlternativeTitles(ID_BLADE_RUNNER, country); results = tmdb.getMovieAlternativeTitles(ID_BLADE_RUNNER, country);
assertTrue("No alternative titles found", results.size() > 0); assertTrue("No alternative titles found", results.size() > 0);
} }
/** /**
* Test of getMovieCasts method, of class TheMovieDb. * Test of getMovieCasts method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieCasts() { public void testGetMovieCasts() {
LOGGER.info("getMovieCasts"); LOGGER.info("getMovieCasts");
List<Person> people = tmdb.getMovieCasts(ID_BLADE_RUNNER); List<Person> people = tmdb.getMovieCasts(ID_BLADE_RUNNER);
assertTrue("No cast information", people.size() > 0); assertTrue("No cast information", people.size() > 0);
String name1 = "Harrison Ford"; String name1 = "Harrison Ford";
String name2 = "Charles Knode"; String name2 = "Charles Knode";
boolean foundName1 = Boolean.FALSE; boolean foundName1 = Boolean.FALSE;
boolean foundName2 = Boolean.FALSE; boolean foundName2 = Boolean.FALSE;
for (Person person : people) { for (Person person : people) {
if (!foundName1 && person.getName().equalsIgnoreCase(name1)) { if (!foundName1 && person.getName().equalsIgnoreCase(name1)) {
foundName1 = Boolean.TRUE; foundName1 = Boolean.TRUE;
} }
if (!foundName2 && person.getName().equalsIgnoreCase(name2)) { if (!foundName2 && person.getName().equalsIgnoreCase(name2)) {
foundName2 = Boolean.TRUE; foundName2 = Boolean.TRUE;
} }
} }
assertTrue("Couldn't find " + name1, foundName1); assertTrue("Couldn't find " + name1, foundName1);
assertTrue("Couldn't find " + name2, foundName2); assertTrue("Couldn't find " + name2, foundName2);
} }
/** /**
* Test of getMovieImages method, of class TheMovieDb. * Test of getMovieImages method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieImages() { public void testGetMovieImages() {
LOGGER.info("getMovieImages"); LOGGER.info("getMovieImages");
String language = ""; String language = "";
List<Artwork> result = tmdb.getMovieImages(ID_BLADE_RUNNER, language); List<Artwork> result = tmdb.getMovieImages(ID_BLADE_RUNNER, language);
assertFalse("No artwork found", result.isEmpty()); assertFalse("No artwork found", result.isEmpty());
} }
/** /**
* Test of getMovieKeywords method, of class TheMovieDb. * Test of getMovieKeywords method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieKeywords() { public void testGetMovieKeywords() {
LOGGER.info("getMovieKeywords"); LOGGER.info("getMovieKeywords");
List<Keyword> result = tmdb.getMovieKeywords(ID_BLADE_RUNNER); List<Keyword> result = tmdb.getMovieKeywords(ID_BLADE_RUNNER);
assertFalse("No keywords found", result.isEmpty()); assertFalse("No keywords found", result.isEmpty());
} }
/** /**
* Test of getMovieReleaseInfo method, of class TheMovieDb. * Test of getMovieReleaseInfo method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieReleaseInfo() { public void testGetMovieReleaseInfo() {
LOGGER.info("getMovieReleaseInfo"); LOGGER.info("getMovieReleaseInfo");
List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_BLADE_RUNNER, ""); List<ReleaseInfo> result = tmdb.getMovieReleaseInfo(ID_BLADE_RUNNER, "");
assertFalse("Release information missing", result.isEmpty()); assertFalse("Release information missing", result.isEmpty());
} }
/** /**
* Test of getMovieTrailers method, of class TheMovieDb. * Test of getMovieTrailers method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieTrailers() { public void testGetMovieTrailers() {
LOGGER.info("getMovieTrailers"); LOGGER.info("getMovieTrailers");
List<Trailer> result = tmdb.getMovieTrailers(ID_BLADE_RUNNER, ""); List<Trailer> result = tmdb.getMovieTrailers(ID_BLADE_RUNNER, "");
assertFalse("Movie trailers missing", result.isEmpty()); assertFalse("Movie trailers missing", result.isEmpty());
} }
/** /**
* Test of getMovieTranslations method, of class TheMovieDb. * Test of getMovieTranslations method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieTranslations() { public void testGetMovieTranslations() {
LOGGER.info("getMovieTranslations"); LOGGER.info("getMovieTranslations");
List<Translation> result = tmdb.getMovieTranslations(ID_BLADE_RUNNER); List<Translation> result = tmdb.getMovieTranslations(ID_BLADE_RUNNER);
assertFalse("No translations found", result.isEmpty()); assertFalse("No translations found", result.isEmpty());
} }
/** /**
* Test of getCollectionInfo method, of class TheMovieDb. * Test of getCollectionInfo method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetCollectionInfo() { public void testGetCollectionInfo() {
LOGGER.info("getCollectionInfo"); LOGGER.info("getCollectionInfo");
String language = ""; String language = "";
CollectionInfo result = tmdb.getCollectionInfo(ID_STAR_WARS_COLLECTION, language); CollectionInfo result = tmdb.getCollectionInfo(ID_STAR_WARS_COLLECTION, language);
assertFalse("No collection information", result.getParts().isEmpty()); assertFalse("No collection information", result.getParts().isEmpty());
} }
@Test @Test
public void testCreateImageUrl() { public void testCreateImageUrl() {
LOGGER.info("createImageUrl"); LOGGER.info("createImageUrl");
MovieDb movie = tmdb.getMovieInfo(ID_BLADE_RUNNER, ""); MovieDb movie = tmdb.getMovieInfo(ID_BLADE_RUNNER, "");
String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString(); String result = tmdb.createImageUrl(movie.getPosterPath(), "original").toString();
assertTrue("Error compiling image URL", !result.isEmpty()); assertTrue("Error compiling image URL", !result.isEmpty());
} }
/** /**
* Test of getMovieInfoImdb method, of class TheMovieDb. * Test of getMovieInfoImdb method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetMovieInfoImdb() { public void testGetMovieInfoImdb() {
LOGGER.info("getMovieInfoImdb"); LOGGER.info("getMovieInfoImdb");
MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US"); MovieDb result = tmdb.getMovieInfoImdb("tt0076759", "en-US");
assertTrue("Error getting the movie from IMDB ID", result.getId() == 11); assertTrue("Error getting the movie from IMDB ID", result.getId() == 11);
} }
/** /**
* Test of getApiKey method, of class TheMovieDb. * Test of getApiKey method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetApiKey() { public void testGetApiKey() {
// Not required // Not required
} }
/** /**
* Test of getApiBase method, of class TheMovieDb. * Test of getApiBase method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetApiBase() { public void testGetApiBase() {
// Not required // Not required
} }
/** /**
* Test of getConfiguration method, of class TheMovieDb. * Test of getConfiguration method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetConfiguration() { public void testGetConfiguration() {
// Not required // Not required
} }
/** /**
* Test of searchPeople method, of class TheMovieDb. * Test of searchPeople method, of class TheMovieDb.
*/ */
@Test @Test
public void testSearchPeople() { public void testSearchPeople() {
LOGGER.info("searchPeople"); LOGGER.info("searchPeople");
String personName = "Bruce Willis"; String personName = "Bruce Willis";
boolean allResults = false; boolean allResults = false;
List<Person> result = tmdb.searchPeople(personName, allResults); List<Person> result = tmdb.searchPeople(personName, allResults);
assertTrue("Couldn't find the person", result.size() > 0); assertTrue("Couldn't find the person", result.size() > 0);
} }
/** /**
* Test of getPersonInfo method, of class TheMovieDb. * Test of getPersonInfo method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetPersonInfo() { public void testGetPersonInfo() {
LOGGER.info("getPersonInfo"); LOGGER.info("getPersonInfo");
Person result = tmdb.getPersonInfo(ID_BRUCE_WILLIS); Person result = tmdb.getPersonInfo(ID_BRUCE_WILLIS);
assertTrue("Wrong actor returned", result.getId() == ID_BRUCE_WILLIS); assertTrue("Wrong actor returned", result.getId() == ID_BRUCE_WILLIS);
} }
/** /**
* Test of getPersonCredits method, of class TheMovieDb. * Test of getPersonCredits method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetPersonCredits() { public void testGetPersonCredits() {
LOGGER.info("getPersonCredits"); LOGGER.info("getPersonCredits");
List<PersonCredit> people = tmdb.getPersonCredits(ID_BRUCE_WILLIS); List<PersonCredit> people = tmdb.getPersonCredits(ID_BRUCE_WILLIS);
assertTrue("No cast information", people.size() > 0); assertTrue("No cast information", people.size() > 0);
} }
/** /**
* Test of getPersonImages method, of class TheMovieDb. * Test of getPersonImages method, of class TheMovieDb.
*/ */
@Test @Test
public void testGetPersonImages() { public void testGetPersonImages() {
LOGGER.info("getPersonImages"); LOGGER.info("getPersonImages");
List<Artwork> artwork = tmdb.getPersonImages(ID_BRUCE_WILLIS); List<Artwork> artwork = tmdb.getPersonImages(ID_BRUCE_WILLIS);
assertTrue("No cast information", artwork.size() > 0); assertTrue("No cast information", artwork.size() > 0);
} }
} /**
* Test of getLatestMovie method, of class TheMovieDb.
*/
@Test
public void testGetLatestMovie() {
LOGGER.info("getLatestMovie");
MovieDb result = tmdb.getLatestMovie();
LOGGER.info(result.toString());
assertTrue("No latest movie found", result.getId() > 0);
}
/**
* Test of compareMovies method, of class TheMovieDb.
*/
@Test
public void testCompareMovies() {
// Not required
}
}