Added bookmark section in not-logged-in version (#4256)

* added bookmark in not-logged-in version

* javadoc

* javadoc update

* spacing

* added unit test
This commit is contained in:
Aditya-Srivastav 2021-02-21 20:53:41 +05:30 committed by GitHub
parent 4f130e4dd0
commit 7d8ea51c4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 119 additions and 12 deletions

View file

@ -21,7 +21,7 @@ class BookmarksPagerAdapterTests {
@Before
fun setUp() {
MockitoAnnotations.initMocks(this)
bookmarksPagerAdapter = BookmarksPagerAdapter(fragmentManager, context)
bookmarksPagerAdapter = BookmarksPagerAdapter(fragmentManager, context, false)
}
@Test

View file

@ -0,0 +1,66 @@
package fr.free.nrw.commons.bookmarks
import android.content.Context
import androidx.fragment.app.FragmentManager
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mockito.Mock
import org.mockito.MockitoAnnotations
/**
* BookmarksPagerAdapter when user is not loggedIn.
*/
class LoggedOutBookmarksPagerAdapterTests {
@Mock
private lateinit var bookmarksPagerAdapter: BookmarksPagerAdapter
@Mock
private lateinit var fragmentManager: FragmentManager
@Mock
private lateinit var context: Context
/**
* Setup the adapter
*/
@Before
fun setUp() {
MockitoAnnotations.initMocks(this)
bookmarksPagerAdapter = BookmarksPagerAdapter(fragmentManager, context, true)
}
/**
* checkNotNull
*/
@Test
fun checkNotNull() {
Assert.assertNotNull(bookmarksPagerAdapter)
}
/**
* getItems
* Logged out bookmark adapter has just one item.
*/
@Test
fun testGetItem() {
bookmarksPagerAdapter.getItem(0)
}
/**
* itemCount
* Logged out bookmark adapter has just one item.
*/
@Test
fun testGetCount() {
Assert.assertEquals(bookmarksPagerAdapter.count, 1)
}
/**
* getTitle.
*/
@Test
fun testGetPageTitle() {
bookmarksPagerAdapter.getPageTitle(0)
}
}