This commit is contained in:
Stuart Boston
2015-02-27 20:57:54 +00:00
parent 8522ac4171
commit 2c71a1485c
4 changed files with 33 additions and 18 deletions
@@ -64,7 +64,7 @@ import com.omertron.themoviedbapi.model2.StatusCode;
import com.omertron.themoviedbapi.enumeration.ExternalSource;
import com.omertron.themoviedbapi.enumeration.SortBy;
import com.omertron.themoviedbapi.model2.FindResults;
import com.omertron.themoviedbapi.model.TBD_Network;
import com.omertron.themoviedbapi.model2.network.Network;
import com.omertron.themoviedbapi.model2.person.CreditInfo;
import com.omertron.themoviedbapi.model2.authentication.TokenAuthorisation;
import com.omertron.themoviedbapi.model2.authentication.TokenSession;
@@ -1139,7 +1139,7 @@ public class TheMovieDbApi {
* @return
* @throws MovieDbException
*/
public TBD_Network getNetworkInfo(int networkId) throws MovieDbException {
public Network getNetworkInfo(int networkId) throws MovieDbException {
return tmdbNetworks.getNetworkInfo(networkId);
}
//</editor-fold>
@@ -20,7 +20,7 @@
package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.model.TBD_Network;
import com.omertron.themoviedbapi.model2.network.Network;
import com.omertron.themoviedbapi.tools.ApiUrl;
import com.omertron.themoviedbapi.tools.HttpTools;
import com.omertron.themoviedbapi.tools.MethodBase;
@@ -56,7 +56,7 @@ public class TmdbNetworks extends AbstractMethod {
* @return
* @throws MovieDbException
*/
public TBD_Network getNetworkInfo(int networkId) throws MovieDbException {
public Network getNetworkInfo(int networkId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, networkId);
@@ -64,7 +64,7 @@ public class TmdbNetworks extends AbstractMethod {
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TBD_Network.class);
return MAPPER.readValue(webpage, Network.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get network information", url, ex);
}
@@ -17,23 +17,22 @@
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model;
package com.omertron.themoviedbapi.model2.network;
import com.omertron.themoviedbapi.model2.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
* @author stuart.boston
*/
@JsonRootName("???")
public class TBD_Network extends AbstractJsonMapping {
public class Network extends AbstractJsonMapping {
private static final long serialVersionUID = 1L;
// Properties
@JsonProperty("id")
private int id;
@JsonProperty("name")
private String name;
public int getId() {
return id;
@@ -42,4 +41,13 @@ public class TBD_Network extends AbstractJsonMapping {
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@@ -21,10 +21,12 @@ package com.omertron.themoviedbapi.methods;
import com.omertron.themoviedbapi.AbstractTests;
import com.omertron.themoviedbapi.MovieDbException;
import com.omertron.themoviedbapi.TestLogger;
import com.omertron.themoviedbapi.model.TBD_Network;
import com.omertron.themoviedbapi.TestID;
import com.omertron.themoviedbapi.model2.network.Network;
import java.util.ArrayList;
import java.util.List;
import org.junit.AfterClass;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -34,16 +36,18 @@ import org.junit.Test;
*/
public class TmdbNetworksTest extends AbstractTests {
// API
private static TmdbNetworks instance;
private static final List<TestID> testIDs = new ArrayList<TestID>();
public TmdbNetworksTest() {
}
@BeforeClass
public static void setUpClass() throws MovieDbException {
TestLogger.Configure();
doConfiguration();
instance = new TmdbNetworks(getApiKey(), getHttpTools());
testIDs.add(new TestID("Fuji Television", "", 1));
testIDs.add(new TestID("Sonshine Media Network International", "", 200));
}
@AfterClass
@@ -58,9 +62,12 @@ public class TmdbNetworksTest extends AbstractTests {
@Test
public void testGetNetworkInfo() throws MovieDbException {
LOG.info("getNetworkInfo");
TBD_Network result = instance.getNetworkInfo(1);
// assertEquals("Wrong network returned", "Fuji Television", result.getName());
fail("The test case is a prototype.");
Network result;
for (TestID t : testIDs) {
result = instance.getNetworkInfo(t.getTmdb());
assertEquals("Wrong network returned", t.getName(), result.getName());
}
}
}