use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testMapToModelWithBadMap.
/**
* Tests the {@link ContentTranslator#mapToModel(Map, Recipe)} with a bad map argument. The map
* is missing the title field so the model should not be valid at the end of translation.
*/
@Test
public void testMapToModelWithBadMap() throws Exception {
Map<String, Object> map = createValidMap();
map.remove("title");
Content content = mContentTranslator.mapToModel(map, mGoodRecipe);
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 testSetMemberVariableExtras.
/**
* Tests the {@link ContentTranslator#setMemberVariable(Content, String, Object)} method for
* the extras member variable.
*/
@Test
public void testSetMemberVariableExtras() throws Exception {
Content content = new Content();
assertTrue(mContentTranslator.setMemberVariable(content, "key1", "value1"));
assertEquals(content.getExtraValue("key1"), "value1");
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testSetMemberVariableDescription.
/**
* Tests the {@link ContentTranslator#setMemberVariable(Content, String, Object)} method for
* the description member variable.
*/
@Test
public void testSetMemberVariableDescription() throws Exception {
String descriptionText = "some description text";
Content content = new Content();
assertTrue(mContentTranslator.setMemberVariable(content, "mDescription", descriptionText));
assertEquals(content.getDescription(), descriptionText);
}
use of com.amazon.android.model.content.Content in project zype-firebuilder by zype.
the class ContentTranslatorTest method testMapToModelWithBadRecipeUrl.
/**
* Tests the {@link ContentTranslator#mapToModel(Map, Recipe)} with a recipe that's missing the
* url field.
*/
@Test
public void testMapToModelWithBadRecipeUrl() throws Exception {
Recipe badRecipe = Recipe.newInstance(getBadContentRecipeJsonString("mUrl"));
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 testMapToModelWithBadRecipeCardImageUrl.
/**
* Tests the {@link ContentTranslator#mapToModel(Map, Recipe)} with a recipe that's missing the
* cardImageUrl field.
*/
@Test
public void testMapToModelWithBadRecipeCardImageUrl() throws Exception {
Recipe badRecipe = Recipe.newInstance(getBadContentRecipeJsonString("mCardImageUrl"));
Content content = mContentTranslator.mapToModel(createValidMap(), badRecipe);
assertNull("Content should be null due to bad translation", content);
}
Aggregations