Search in sources :

Example 16 with TestItem

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

the class HackerNewsItemTest method testGetDisplayedTitleNonComment.

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

        @Override
        public String getRawType() {
            return "story";
        }

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

Example 17 with TestItem

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

the class HackerNewsItemTest method testGetDisplayedTitleComment.

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

        @Override
        public String getRawType() {
            return "comment";
        }

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

Example 18 with TestItem

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

the class HackerNewsItemTest method testGetType.

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

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

Example 19 with TestItem

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

the class HackerNewsItemTest method testIsShareable.

@Test
public void testIsShareable() {
    assertTrue(item.isStoryType());
    item.populate(new TestItem() {

        @Override
        public String getRawType() {
            return "comment";
        }
    });
    assertFalse(item.isStoryType());
    item.populate(new TestItem() {

        @Override
        public String getRawType() {
            return "poll";
        }
    });
    assertTrue(item.isStoryType());
}
Also used : TestItem(io.github.hidroh.materialistic.test.TestItem) Test(org.junit.Test)

Example 20 with TestItem

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

the class HackerNewsItemTest method testHasNewKids.

@Test
public void testHasNewKids() {
    assertFalse(item.hasNewKids());
    item.populate(new TestItem() {

        @Override
        public int getDescendants() {
            return 0;
        }
    });
    assertFalse(item.hasNewKids());
    item.populate(new TestItem() {

        @Override
        public int getDescendants() {
            return 1;
        }
    });
    assertTrue(item.hasNewKids());
    item.populate(new TestItem() {

        @Override
        public int getDescendants() {
            return 1;
        }
    });
    assertFalse(item.hasNewKids());
}
Also used : 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