Skip to content

Commit

Permalink
Supplied rules:1.1.0-alpha4
Browse files Browse the repository at this point in the history
  • Loading branch information
drakeet committed Sep 22, 2018
1 parent 2bc165c commit d1a54a9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions library-ktx/src/test/java/me/drakeet/multitype/MultiTypeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

package me.drakeet.multitype

import junit.framework.Assert
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
Expand All @@ -34,14 +35,14 @@ class MultiTypeTest {
@Test
fun shouldEqualToRegisteredKClass() {
adapter.register(String::class, StringViewBinder())
Assert.assertEquals(adapter.typePool.getClass(0), String::class.java)
assertEquals(adapter.typePool.getClass(0), String::class.java)
}


@Test
fun shouldEqualToRegisteredKClass_Reified() {
adapter.register(StringViewBinder())
Assert.assertEquals(adapter.typePool.getClass(0), String::class.java)
assertEquals(adapter.typePool.getClass(0), String::class.java)
}


Expand All @@ -50,27 +51,27 @@ class MultiTypeTest {
adapter.register(String::class)
.to(StringViewBinder())
.withLinker(simpleLinker)
Assert.assertEquals(adapter.typePool.getClass(0), String::class.java)
assertEquals(adapter.typePool.getClass(0), String::class.java)
}


@Test
fun shouldEqualToRegisteredKClass_TypePool() {
adapter.typePool.register(String::class, StringViewBinder(), simpleLinker)
Assert.assertEquals(adapter.typePool.getClass(0), String::class.java)
assertEquals(adapter.typePool.getClass(0), String::class.java)
}


@Test
fun shouldUnregisterKClass_TypePool() {
adapter.typePool.register(String::class, StringViewBinder(), simpleLinker)
Assert.assertTrue(adapter.typePool.unregister(String::class))
assertTrue(adapter.typePool.unregister(String::class))
}


@Test
fun shouldEqualToRegisteredFirstKClass_TypePool() {
adapter.typePool.register(String::class, StringViewBinder(), simpleLinker)
Assert.assertEquals(adapter.typePool.firstIndexOf(String::class), 0)
assertEquals(adapter.typePool.firstIndexOf(String::class), 0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public void shouldThrowIllegalStateException() {


private static class TestItemViewBinder extends me.drakeet.multitype.TestItemViewBinder {

private void notifyTestItemAdded() {
assertNotNull(getAdapter().toString());
}
Expand Down
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
implementation project(':library')
implementation project(':library-ktx')
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
androidTestImplementation 'androidx.test:rules:1.1.0-alpha4'
androidTestImplementation "androidx.annotation:annotation:${gradle.androidXVersion}"
implementation "androidx.appcompat:appcompat:${gradle.androidXVersion}"
implementation "androidx.recyclerview:recyclerview:${gradle.androidXVersion}"
Expand Down

0 comments on commit d1a54a9

Please sign in to comment.