assertTrue(content.equals("content for default"));
}
@Test
public void canGetMostReleventContent() {
ContentAPI contentAPI = new ContentAPI();
//add tags
contentAPI.addNewTag("testtag_melbourne", helper.loginAsDeveloper());
contentAPI.addNewTag("testtag_vic", helper.loginAsDeveloper());
contentAPI.addNewTag("testtag_australia", helper.loginAsDeveloper());
contentAPI.addNewTag("testtag_default", helper.loginAsDeveloper());
//add content for city
contentAPI.setContent("content for melbourne", "testtag_melbourne",
true, helper.loginAsPortalAdmin());
//add content for region
contentAPI.setContent("content for victoria", "testtag_vic",
true, helper.loginAsPortalAdmin());
//add content for country
contentAPI.setContent("content for australia", "testtag_australia",
true, helper.loginAsPortalAdmin());
//add default content
contentAPI.setContent("content for default", "testtag_default",
true, helper.loginAsPortalAdmin());
//city content if available
GeoLocationAPI geoLocationAPI = new GeoLocationAPI();
APIResponse response = geoLocationAPI.
getMostRelevantContent("testtag", "melbourne",
"vic", "australia");
String content = (String) response.object;
assertTrue(content.equals("content for melbourne"));
assertTrue(response.userFriendlyMessage.contains("testtag_melbourne"));
//region content if city content is not available
response = geoLocationAPI.
getMostRelevantContent("testtag", "portland",
"vic", "australia");
content = (String) response.object;
assertTrue(content.equals("content for victoria"));
assertTrue(response.userFriendlyMessage.contains("testtag_vic"));
//country content if both city and region not available
response = geoLocationAPI.
getMostRelevantContent("testtag", "sydney",
"new south wales", "australia");
content = (String) response.object;
assertTrue(content.equals("content for australia"));
assertTrue(response.userFriendlyMessage.contains("testtag_australia"));
//default content if city, region and country contents not available
response = contentAPI.setPublishStatus("testtag_australia", false, helper.loginAsPortalAdmin());
assertTrue(response.statusCode == Status.SUCCESS);
response = geoLocationAPI.
getMostRelevantContent("testtag", "sydney",
"new south wales", "australia");