Search in sources :

Example 26 with TestItem

use of io.github.hidroh.materialistic.test.TestItem in project materialistic by hidroh.

the class HackerNewsItemTest method testGetTypeDefault.

@Test
public void testGetTypeDefault() {
    item.populate(new TestItem() {

        @Override
        public String getRawType() {
            return null;
        }
    });
    assertEquals(Item.STORY_TYPE, item.getType());
}
Also used : TestItem(io.github.hidroh.materialistic.test.TestItem) Test(org.junit.Test)

Example 27 with TestItem

use of io.github.hidroh.materialistic.test.TestItem in project materialistic by hidroh.

the class HackerNewsItemTest method testKidCount.

@Test
public void testKidCount() {
    item.populate(new TestItem() {

        @Override
        public int getDescendants() {
            return 10;
        }
    });
    assertEquals(10, item.getKidCount());
}
Also used : TestItem(io.github.hidroh.materialistic.test.TestItem) Test(org.junit.Test)

Example 28 with TestItem

use of io.github.hidroh.materialistic.test.TestItem in project materialistic by hidroh.

the class HackerNewsItemTest method testLastKidCount.

@Test
public void testLastKidCount() {
    item.populate(new TestItem() {

        @Override
        public int getDescendants() {
            return 0;
        }
    });
    assertEquals(0, item.getLastKidCount());
    item.setLastKidCount(1);
    assertEquals(1, item.getLastKidCount());
}
Also used : TestItem(io.github.hidroh.materialistic.test.TestItem) Test(org.junit.Test)

Example 29 with TestItem

use of io.github.hidroh.materialistic.test.TestItem in project materialistic by hidroh.

the class HackerNewsItemTest method testGetTypeInvalid.

@Test
public void testGetTypeInvalid() {
    item.populate(new TestItem() {

        @Override
        public String getRawType() {
            return "blah";
        }
    });
    assertEquals("blah", item.getType());
}
Also used : TestItem(io.github.hidroh.materialistic.test.TestItem) Test(org.junit.Test)

Example 30 with TestItem

use of io.github.hidroh.materialistic.test.TestItem in project materialistic by hidroh.

the class HackerNewsItemTest method testParcelReadWrite.

@Test
public void testParcelReadWrite() {
    Parcel parcel = Parcel.obtain();
    item.populate(new TestItem() {

        @Override
        public String getTitle() {
            return "title";
        }
    });
    item.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);
    Item actual = HackerNewsItem.CREATOR.createFromParcel(parcel);
    assertEquals("title", actual.getDisplayedTitle());
    assertFalse(actual.isFavorite());
}
Also used : TestItem(io.github.hidroh.materialistic.test.TestItem) Parcel(android.os.Parcel) TestItem(io.github.hidroh.materialistic.test.TestItem) Test(org.junit.Test)

Aggregations

TestItem (io.github.hidroh.materialistic.test.TestItem)40 Test (org.junit.Test)38 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)15 Intent (android.content.Intent)12 Bundle (android.os.Bundle)9 NonNull (android.support.annotation.NonNull)8 Fragment (android.support.v4.app.Fragment)7 RoboMenuItem (org.robolectric.fakes.RoboMenuItem)5 TextView (android.widget.TextView)4 TestHnItem (io.github.hidroh.materialistic.data.TestHnItem)4 RecyclerView (android.support.v7.widget.RecyclerView)3 WebView (android.webkit.WebView)3 HackerNewsClient (io.github.hidroh.materialistic.data.HackerNewsClient)3 ShadowWebView (org.robolectric.shadows.ShadowWebView)3 SuppressLint (android.annotation.SuppressLint)2 Parcel (android.os.Parcel)2 TabLayout (android.support.design.widget.TabLayout)2 Item (io.github.hidroh.materialistic.data.Item)2 ResponseListener (io.github.hidroh.materialistic.data.ResponseListener)2 WebItem (io.github.hidroh.materialistic.data.WebItem)2