Search in sources :

Example 51 with Content

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);
}
Also used : Content(com.amazon.android.model.content.Content) Test(org.junit.Test)

Example 52 with 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");
}
Also used : Content(com.amazon.android.model.content.Content) Test(org.junit.Test)

Example 53 with Content

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);
}
Also used : Content(com.amazon.android.model.content.Content) Test(org.junit.Test)

Example 54 with Content

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);
}
Also used : Recipe(com.amazon.android.recipe.Recipe) Content(com.amazon.android.model.content.Content) Test(org.junit.Test)

Example 55 with 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);
}
Also used : Recipe(com.amazon.android.recipe.Recipe) Content(com.amazon.android.model.content.Content) Test(org.junit.Test)

Aggregations

Content (com.amazon.android.model.content.Content)76 ContentContainer (com.amazon.android.model.content.ContentContainer)28 Test (org.junit.Test)26 ArrayObjectAdapter (androidx.leanback.widget.ArrayObjectAdapter)13 ListRow (androidx.leanback.widget.ListRow)13 ArrayList (java.util.ArrayList)11 Recipe (com.amazon.android.recipe.Recipe)10 Intent (android.content.Intent)8 RecentDatabaseHelper (com.amazon.android.contentbrowser.database.helpers.RecentDatabaseHelper)7 TextUtils (android.text.TextUtils)6 RecentRecord (com.amazon.android.contentbrowser.database.records.RecentRecord)6 CardPresenter (com.amazon.android.tv.tenfoot.presenter.CardPresenter)6 List (java.util.List)6 Context (android.content.Context)5 HeaderItem (androidx.leanback.widget.HeaderItem)5 Action (com.amazon.android.model.Action)5 NavigatorModel (com.amazon.android.navigator.NavigatorModel)5 AndroidSchedulers (rx.android.schedulers.AndroidSchedulers)5 Bundle (android.os.Bundle)4 Log (android.util.Log)4