use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method createValidContent.
/**
* Creates a valid {@link Content} model to test with.
*/
private Content createValidContent() throws Exception {
Content content = new Content();
content.setId("1");
content.setTitle("Good Content");
content.setSubtitle("Good Subtitle");
content.setUrl("www.someUrl.com");
content.setDescription("Good description of good content");
content.setCardImageUrl("www.someUrl.com");
content.setBackgroundImageUrl("www.someUrl.com");
content.setTags("[tag1, tag2, tag3]");
content.setExtraValue("key1", "value1");
content.setExtraValue("key2", "www.someUrl.com");
return content;
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testMapToModelWithBadRecipeDescription.
/**
* Tests the {@link ContentTranslator#mapToModel(Map, Recipe)} with a recipe that's missing the
* description field.
*/
@Test
public void testMapToModelWithBadRecipeDescription() throws Exception {
Recipe badRecipe = Recipe.newInstance(getBadContentRecipeJsonString("mDescription"));
Content content = mContentTranslator.mapToModel(createValidMap(), badRecipe);
assertNull("Content should be null due to bad translation", content);
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testValidateModelFalseBackgroundImageUrl.
/**
* Tests the {@link ContentTranslator#validateModel(Content)} method for the false case where
* the backgroundImageUrl is invalid.
*/
@Test
public void testValidateModelFalseBackgroundImageUrl() throws Exception {
Content content = createValidContent();
// make good content bad
content.setBackgroundImageUrl("");
assertFalse(mContentTranslator.validateModel(content));
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testSetMemberVariableUrl.
/**
* Tests the {@link ContentTranslator#setMemberVariable(Content, String, Object)} method for
* the url member variable.
*/
@Test
public void testSetMemberVariableUrl() throws Exception {
String urlText = "www.someUrl.com";
Content content = new Content();
assertTrue(mContentTranslator.setMemberVariable(content, "mUrl", urlText));
assertEquals(content.getUrl(), urlText);
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testSetMemberVariableTitle.
/**
* Tests the {@link ContentTranslator#setMemberVariable(Content, String, Object)} method for
* the title member variable.
*/
@Test
public void testSetMemberVariableTitle() throws Exception {
String titleText = "Good Content";
Content content = new Content();
assertTrue(mContentTranslator.setMemberVariable(content, "mTitle", titleText));
assertEquals(content.getTitle(), titleText);
}
Aggregations