Search in sources :

Example 16 with Content

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

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

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

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

Example 20 with Content

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);
}
Also used : 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