[go: nahoru, domu]

Cleanup material tests.

Mainly:
- Use runOnIdleCompose when touching variables from compose thread.
- Statically import Truth methods and use Truth consistently.

Bug: N/A
Test: N/A
Change-Id: I2bc815ce3331913c94a475d48940642e8695efe6
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
index fff471e..6422e6d 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/AppBarTest.kt
@@ -19,9 +19,7 @@
 import androidx.compose.Composable
 import androidx.test.filters.SmallTest
 import androidx.ui.core.dp
-import androidx.ui.core.withDensity
 import androidx.ui.layout.Container
-import com.google.common.truth.Truth
 import androidx.ui.core.LastBaseline
 import androidx.ui.core.LayoutCoordinates
 import androidx.ui.core.OnChildPositioned
@@ -46,6 +44,7 @@
 import androidx.ui.test.createComposeRule
 import androidx.ui.test.findAllByTag
 import androidx.ui.test.findByText
+import com.google.common.truth.Truth.assertThat
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -121,16 +120,16 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Navigation icon should be 16.dp from the start
             val navigationIconPositionX = navigationIconCoords!!.localToGlobal(PxPosition.Origin).x
             val navigationIconExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
+            assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
 
             // Title should be 72.dp from the start
             val titlePositionX = titleCoords!!.localToGlobal(PxPosition.Origin).x
             val titleExpectedPositionX = 72.dp.toIntPx().toPx()
-            Truth.assertThat(titlePositionX).isEqualTo(titleExpectedPositionX)
+            assertThat(titlePositionX).isEqualTo(titleExpectedPositionX)
 
             // Absolute position of the baseline
             val titleLastBaselinePositionY = titleLastBaselineRelativePosition!! +
@@ -139,14 +138,14 @@
                     appBarCoords!!.size.height
             // Baseline should be 20.sp from the bottom of the app bar
             val titleExpectedLastBaselinePositionY = appBarBottomEdgeY - 20.sp.toIntPx().toPx()
-            Truth.assertThat(titleLastBaselinePositionY)
+            assertThat(titleLastBaselinePositionY)
                 .isEqualTo(titleExpectedLastBaselinePositionY)
 
             // Action should be placed at the end
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX =
                 appBarCoords!!.size.width - 16.dp.toIntPx() - 24.dp.toIntPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
         }
     }
 
@@ -179,17 +178,17 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Title should now be placed 16.dp from the start, as there is no navigation icon
             val titlePositionX = titleCoords!!.localToGlobal(PxPosition.Origin).x
             val titleExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(titlePositionX).isEqualTo(titleExpectedPositionX)
+            assertThat(titlePositionX).isEqualTo(titleExpectedPositionX)
 
             // Action should still be placed at the end
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX =
                 appBarCoords!!.size.width - 16.dp.toIntPx() - 24.dp.toIntPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
         }
     }
 
@@ -247,8 +246,8 @@
                 )
             }
         }
-        Truth.assertThat(textStyle!!.fontSize).isEqualTo(h6Style!!.fontSize)
-        Truth.assertThat(textStyle!!.fontFamily).isEqualTo(h6Style!!.fontFamily)
+        assertThat(textStyle!!.fontSize).isEqualTo(h6Style!!.fontSize)
+        assertThat(textStyle!!.fontFamily).isEqualTo(h6Style!!.fontFamily)
     }
 
     @Test
@@ -283,12 +282,12 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Action should still be placed at the end, even though there is no navigation icon
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX = appBarCoords!!.size.width.round().toPx() -
                     16.dp.toIntPx().toPx() - 24.dp.toIntPx().toPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
         }
     }
 
@@ -321,17 +320,17 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Navigation icon should be at the beginning
             val navigationIconPositionX = navigationIconCoords!!.localToGlobal(PxPosition.Origin).x
             val navigationIconExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
+            assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
 
             // Action should be placed at the end
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX = appBarCoords!!.size.width.round().toPx() -
                     16.dp.toIntPx().toPx() - 24.dp.toIntPx().toPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
         }
     }
 
@@ -372,23 +371,23 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Navigation icon should be at the beginning
             val navigationIconPositionX = navigationIconCoords!!.localToGlobal(PxPosition.Origin).x
             val navigationIconExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
+            assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
 
             // FAB should be placed in the center
             val fabPositionX = fabCoords!!.localToGlobal(PxPosition.Origin).x
             val fabExpectedPositionX =
                 ((appBarCoords!!.size.width - 24.dp.toPx()) / 2).round().toPx()
-            Truth.assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
+            assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
 
             // Action should be placed at the end
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX = appBarCoords!!.size.width.round().toPx() -
                     16.dp.toIntPx().toPx() - 24.dp.toIntPx().toPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
         }
     }
 
@@ -429,23 +428,23 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Navigation icon should be at the beginning
             val navigationIconPositionX = navigationIconCoords!!.localToGlobal(PxPosition.Origin).x
             val navigationIconExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
+            assertThat(navigationIconPositionX).isEqualTo(navigationIconExpectedPositionX)
 
             // FAB should be placed in the center
             val fabPositionX = fabCoords!!.localToGlobal(PxPosition.Origin).x
             val fabExpectedPositionX =
                 ((appBarCoords!!.size.width - 24.dp.toPx()) / 2).round().toPx()
-            Truth.assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
+            assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
 
             // Action should be placed at the end
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX = appBarCoords!!.size.width.round().toPx() -
                     16.dp.toIntPx().toPx() - 24.dp.toIntPx().toPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
         }
     }
 
@@ -478,17 +477,17 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Action should be placed at the start
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
 
             // FAB should be placed at the end
             val fabPositionX = fabCoords!!.localToGlobal(PxPosition.Origin).x
             val fabExpectedPositionX = appBarCoords!!.size.width.round().toPx() -
                     16.dp.toIntPx().toPx() - 24.dp.toIntPx().toPx()
-            Truth.assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
+            assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
         }
     }
 
@@ -521,17 +520,17 @@
             }
         }
 
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             // Action should be placed at the start
             val actionPositionX = actionCoords!!.localToGlobal(PxPosition.Origin).x
             val actionExpectedPositionX = 16.dp.toIntPx().toPx()
-            Truth.assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
+            assertThat(actionPositionX).isEqualTo(actionExpectedPositionX)
 
             // FAB should be placed at the end
             val fabPositionX = fabCoords!!.localToGlobal(PxPosition.Origin).x
             val fabExpectedPositionX = appBarCoords!!.size.width.round().toPx() -
                     16.dp.toIntPx().toPx() - 24.dp.toIntPx().toPx()
-            Truth.assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
+            assertThat(fabPositionX).isEqualTo(fabExpectedPositionX)
         }
     }
 
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
index d6885e7..2688cd7 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
@@ -45,14 +45,10 @@
 import androidx.ui.test.findByText
 import androidx.ui.text.TextStyle
 import com.google.common.truth.Truth.assertThat
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertTrue
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
-import java.util.concurrent.CountDownLatch
-import java.util.concurrent.TimeUnit
 
 @MediumTest
 @RunWith(JUnit4::class)
@@ -67,7 +63,6 @@
 
     @Test
     fun buttonTest_defaultSemantics() {
-
         composeTestRule.setMaterialContent {
             Center {
                 TestTag(tag = "myButton") {
@@ -82,7 +77,6 @@
 
     @Test
     fun buttonTest_disabledSemantics() {
-
         composeTestRule.setMaterialContent {
             Center {
                 TestTag(tag = "myButton") {
@@ -117,8 +111,7 @@
             .doClick()
 
         composeTestRule.runOnIdleCompose {
-            assertThat(counter)
-                .isEqualTo(1)
+            assertThat(counter).isEqualTo(1)
         }
     }
 
@@ -285,18 +278,14 @@
     private fun assertLeftPaddingIs(padding: Dp, style: @Composable() () -> ButtonStyle) {
         var parentCoordinates: LayoutCoordinates? = null
         var childCoordinates: LayoutCoordinates? = null
-        val parentLatch = CountDownLatch(1)
-        val childLatch = CountDownLatch(1)
         composeTestRule.setMaterialContent {
             Wrap {
                 Button( style = style()) {
                     OnPositioned {
                         parentCoordinates = it
-                        parentLatch.countDown()
                     }
                     OnChildPositioned(>
                         childCoordinates = it
-                        childLatch.countDown()
                     }) {
                         Text("Test button")
                     }
@@ -304,10 +293,13 @@
             }
         }
 
-        assertTrue(parentLatch.await(1, TimeUnit.SECONDS))
-        assertTrue(childLatch.await(1, TimeUnit.SECONDS))
-        val topLeft = childCoordinates!!.localToGlobal(PxPosition.Origin).x -
-                parentCoordinates!!.localToGlobal(PxPosition.Origin).x
-        assertEquals(topLeft, withDensity(composeTestRule.density) { padding.toIntPx().toPx() })
+        composeTestRule.runOnIdleCompose {
+            val topLeft = childCoordinates!!.localToGlobal(PxPosition.Origin).x -
+                    parentCoordinates!!.localToGlobal(PxPosition.Origin).x
+            val currentPadding = withDensity(composeTestRule.density) {
+                padding.toIntPx().toPx()
+            }
+            assertThat(currentPadding).isEqualTo(topLeft)
+        }
     }
 }
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
index 64f08a7..3f915b8 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
@@ -24,14 +24,13 @@
 import androidx.ui.core.TestTag
 import androidx.ui.core.dp
 import androidx.ui.core.round
-import androidx.ui.core.withDensity
 import androidx.ui.foundation.Clickable
 import androidx.ui.layout.Container
 import androidx.ui.semantics.Semantics
 import androidx.ui.test.createComposeRule
 import androidx.ui.test.doClick
 import androidx.ui.test.findByTag
-import com.google.common.truth.Truth
+import com.google.common.truth.Truth.assertThat
 import org.junit.Ignore
 import org.junit.Rule
 import org.junit.Test
@@ -61,7 +60,9 @@
                 }
             }) {}
         }
-        Truth.assertThat(position!!.x.value).isEqualTo(0f)
+        composeTestRule.runOnIdleCompose {
+            assertThat(position!!.x.value).isEqualTo(0f)
+        }
     }
 
     @Test
@@ -77,7 +78,9 @@
             }) {}
         }
         val width = composeTestRule.displayMetrics.widthPixels
-        Truth.assertThat(position!!.x.round().value).isEqualTo(-width)
+        composeTestRule.runOnIdleCompose {
+            assertThat(position!!.x.round().value).isEqualTo(-width)
+        }
     }
 
     @Test
@@ -94,8 +97,8 @@
         }
 
         val width = composeTestRule.displayMetrics.widthPixels
-        withDensity(composeTestRule.density) {
-            Truth.assertThat(size!!.width.round().value)
+        composeTestRule.runOnIdleComposeWithDensity {
+            assertThat(size!!.width.round().value)
                 .isEqualTo(width - 56.dp.toPx().round().value)
         }
     }
@@ -112,11 +115,14 @@
                 }
             }) {}
         }
+
         val width = composeTestRule.displayMetrics.widthPixels
         val height = composeTestRule.displayMetrics.heightPixels
         // temporary calculation of landscape screen
         val expectedHeight = if (width > height) height else (height / 2f).roundToInt()
-        Truth.assertThat(position!!.y.round().value).isEqualTo(expectedHeight)
+        composeTestRule.runOnIdleCompose {
+            assertThat(position!!.y.round().value).isEqualTo(expectedHeight)
+        }
     }
 
     @Test
@@ -132,7 +138,9 @@
             }) {}
         }
         val height = composeTestRule.displayMetrics.heightPixels
-        Truth.assertThat(position!!.y.round().value).isEqualTo(height)
+        composeTestRule.runOnIdleCompose {
+            assertThat(position!!.y.round().value).isEqualTo(height)
+        }
     }
 
     @Test
@@ -175,11 +183,9 @@
             .doClick()
 
         composeTestRule.runOnIdleCompose {
-            Truth.assertThat(drawerClicks).isEqualTo(0)
-            Truth.assertThat(bodyClicks).isEqualTo(1)
-        }
+            assertThat(drawerClicks).isEqualTo(0)
+            assertThat(bodyClicks).isEqualTo(1)
 
-        composeTestRule.runOnUiThread {
             drawerState.state = DrawerState.Opened
         }
 
@@ -187,8 +193,8 @@
             .doClick()
 
         composeTestRule.runOnIdleCompose {
-            Truth.assertThat(drawerClicks).isEqualTo(1)
-            Truth.assertThat(bodyClicks).isEqualTo(1)
+            assertThat(drawerClicks).isEqualTo(1)
+            assertThat(bodyClicks).isEqualTo(1)
         }
     }
 
@@ -220,8 +226,10 @@
         findByTag("Drawer")
             .doClick()
 
-        Truth.assertThat(drawerClicks).isEqualTo(0)
-        Truth.assertThat(bodyClicks).isEqualTo(1)
+        composeTestRule.runOnIdleCompose {
+            assertThat(drawerClicks).isEqualTo(0)
+            assertThat(bodyClicks).isEqualTo(1)
+        }
 
         // TODO (malkov/pavlis) : uncomment this when custom onClick location will be implemented
 //        composeTestRule.runOnUiThread {
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/EmphasisTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/EmphasisTest.kt
index 314115d..3b4c3a7 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/EmphasisTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/EmphasisTest.kt
@@ -21,7 +21,7 @@
 import androidx.ui.foundation.contentColor
 import androidx.ui.material.surface.Surface
 import androidx.ui.test.createComposeRule
-import org.junit.Assert.assertEquals
+import com.google.common.truth.Truth.assertThat
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -54,15 +54,9 @@
             MaterialTheme(colors) {
                 Surface {
                     val >
-                    assertEquals(
-                        onSurface,
-                        contentColor()
-                    )
 
-                    assertEquals(
-                        onSurface,
-                        currentTextStyle().color
-                    )
+                    assertThat(contentColor()).isEqualTo(onSurface)
+                    assertThat(currentTextStyle().color).isEqualTo(onSurface)
                 }
             }
         }
@@ -76,15 +70,9 @@
                     ProvideEmphasis(MaterialTheme.emphasisLevels().high) {
                         val >
                         val modifiedOnSurface = onSurface.copy(alpha = HighEmphasisAlpha)
-                        assertEquals(
-                            modifiedOnSurface,
-                            contentColor()
-                        )
 
-                        assertEquals(
-                            modifiedOnSurface,
-                            currentTextStyle().color
-                        )
+                        assertThat(contentColor()).isEqualTo(modifiedOnSurface)
+                        assertThat(currentTextStyle().color).isEqualTo(modifiedOnSurface)
                     }
                 }
             }
@@ -99,15 +87,9 @@
                     ProvideEmphasis(MaterialTheme.emphasisLevels().medium) {
                         val >
                         val modifiedOnSurface = onSurface.copy(alpha = MediumEmphasisAlpha)
-                        assertEquals(
-                            modifiedOnSurface,
-                            contentColor()
-                        )
 
-                        assertEquals(
-                            modifiedOnSurface,
-                            currentTextStyle().color
-                        )
+                        assertThat(contentColor()).isEqualTo(modifiedOnSurface)
+                        assertThat(currentTextStyle().color).isEqualTo(modifiedOnSurface)
                     }
                 }
             }
@@ -122,15 +104,9 @@
                     ProvideEmphasis(MaterialTheme.emphasisLevels().disabled) {
                         val >
                         val modifiedOnSurface = onSurface.copy(alpha = DisabledEmphasisAlpha)
-                        assertEquals(
-                            modifiedOnSurface,
-                            contentColor()
-                        )
 
-                        assertEquals(
-                            modifiedOnSurface,
-                            currentTextStyle().color
-                        )
+                        assertThat(contentColor()).isEqualTo(modifiedOnSurface)
+                        assertThat(currentTextStyle().color).isEqualTo(modifiedOnSurface)
                     }
                 }
             }
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt
index 28a47f2..b6e0bbd 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FloatingActionButtonUiTest.kt
@@ -23,7 +23,7 @@
 import androidx.ui.graphics.Image
 import androidx.ui.graphics.ImageConfig
 import androidx.ui.test.createComposeRule
-import com.google.common.truth.Truth
+import com.google.common.truth.Truth.assertThat
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -52,8 +52,8 @@
                 FloatingActionButton(icon = createImage(), text = "Extended")
             }
         withDensity(composeTestRule.density) {
-            Truth.assertThat(size.width.round().value).isAtLeast(48.dp.toIntPx().value)
-            Truth.assertThat(size.height.round()).isEqualTo(48.dp.toIntPx())
+            assertThat(size.width.round().value).isAtLeast(48.dp.toIntPx().value)
+            assertThat(size.height.round()).isEqualTo(48.dp.toIntPx())
         }
     }
 
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
index 70c4aa1..c0bc423 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
@@ -32,7 +32,6 @@
 import androidx.ui.core.px
 import androidx.ui.core.round
 import androidx.ui.core.toPx
-import androidx.ui.core.withDensity
 import androidx.ui.foundation.SimpleImage
 import androidx.ui.graphics.Image
 import androidx.ui.layout.Container
@@ -206,7 +205,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
             assertThat(textPosition.value!!.y).isEqualTo(
                 ((listItemHeight.toIntPx() - textSize.value!!.height.round()) / 2).toPx()
@@ -240,7 +239,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(iconPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
             assertThat(iconPosition.value!!.y).isEqualTo(
                 ((listItemHeight.toIntPx() - iconSize.value!!.height.round()) / 2).toPx()
@@ -296,7 +295,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(textPosition.value!!.x).isEqualTo(expectedLeftPadding.toIntPx().toPx())
             assertThat(textBaseline.value!!).isEqualTo(expectedTextBaseline.toIntPx().toPx())
             assertThat(secondaryTextPosition.value!!.x).isEqualTo(
@@ -356,7 +355,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(textPosition.value!!.x).isEqualTo(
                 expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
                         expectedContentLeftPadding.toIntPx().toPx()
@@ -423,7 +422,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(textPosition.value!!.x).isEqualTo(
                 expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
                         expectedContentLeftPadding.toIntPx().toPx()
@@ -498,7 +497,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(textPosition.value!!.x).isEqualTo(
                 expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
                         expectedContentLeftPadding.toIntPx().toPx()
@@ -592,7 +591,7 @@
                 )
             }
         }
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             assertThat(textPosition.value!!.x).isEqualTo(
                 expectedLeftPadding.toIntPx().toPx() + iconSize.value!!.width +
                         expectedContentLeftPadding.toIntPx().toPx()
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
index 25e5e69..7e859ae 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/MaterialTest.kt
@@ -17,6 +17,7 @@
 package androidx.ui.material
 
 import androidx.compose.Composable
+import androidx.ui.core.DensityScope
 import androidx.ui.core.PxSize
 import androidx.ui.test.BigTestConstraints
 import androidx.ui.test.CollectedSizes
@@ -32,7 +33,11 @@
         }
     }
 }
-
+fun <T> ComposeTestRule.runOnIdleComposeWithDensity(action: DensityScope.() -> T): T {
+    return runOnIdleCompose {
+        DensityScope(density).action()
+    }
+}
 fun ComposeTestRule.setMaterialContentAndCollectSizes(
     parentConstraints: DpConstraints = BigTestConstraints,
     children: @Composable() () -> Unit
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
index 6d221a5..b19d584 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
@@ -34,7 +34,7 @@
 import androidx.ui.test.createComposeRule
 import androidx.ui.test.doClick
 import androidx.ui.test.findByText
-import com.google.common.truth.Truth
+import com.google.common.truth.Truth.assertThat
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -62,13 +62,13 @@
         findByText("Message")
             .assertIsVisible()
 
-        Truth.assertThat(clicked).isFalse()
+        assertThat(clicked).isFalse()
 
         findByText("UNDO")
             .assertIsVisible()
             .doClick()
 
-        Truth.assertThat(clicked).isTrue()
+        assertThat(clicked).isTrue()
     }
 
     @Test
@@ -88,14 +88,14 @@
         sizes
             .assertHeightEqualsTo(48.dp)
             .assertWidthEqualsTo(300.dp)
-        Truth.assertThat(textCoords).isNotNull()
+        assertThat(textCoords).isNotNull()
         textCoords?.let {
             withDensity(composeTestRule.density) {
                 val alignmentLines = it.providedAlignmentLines
-                Truth.assertThat(alignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(alignmentLines.get(FirstBaseline))
+                assertThat(alignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(alignmentLines.get(FirstBaseline))
                     .isEqualTo(alignmentLines.get(LastBaseline))
-                Truth.assertThat(it.position.y.round() + alignmentLines.getValue(FirstBaseline))
+                assertThat(it.position.y.round() + alignmentLines.getValue(FirstBaseline))
                     .isEqualTo(30.dp.toIntPx())
             }
         }
@@ -132,10 +132,10 @@
         sizes
             .assertHeightEqualsTo(48.dp)
             .assertWidthEqualsTo(300.dp)
-        Truth.assertThat(textCoords).isNotNull()
-        Truth.assertThat(buttonCoords).isNotNull()
-        Truth.assertThat(buttonTextCoords).isNotNull()
-        Truth.assertThat(snackCoords).isNotNull()
+        assertThat(textCoords).isNotNull()
+        assertThat(buttonCoords).isNotNull()
+        assertThat(buttonTextCoords).isNotNull()
+        assertThat(snackCoords).isNotNull()
         val localTextCoords = textCoords
         val localButtonCoords = buttonCoords
         val localButtonTextCoords = buttonTextCoords
@@ -151,13 +151,13 @@
                 val buttonAlignmentLines = localButtonTextCoords.providedAlignmentLines
                 val buttonTextPos =
                     localSnackCoords.childToLocal(localButtonTextCoords, PxPosition.Origin)
-                Truth.assertThat(textAlignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(buttonAlignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(
+                assertThat(textAlignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(buttonAlignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(
                     localTextCoords.globalPosition.y.round() +
                             textAlignmentLines.getValue(FirstBaseline)
                 ).isEqualTo(30.dp.toIntPx())
-                Truth.assertThat(
+                assertThat(
                     buttonTextPos.y.round() + buttonAlignmentLines.getValue(FirstBaseline)
                 ).isEqualTo(30.dp.toIntPx())
             }
@@ -181,16 +181,16 @@
         sizes
             .assertHeightEqualsTo(68.dp)
             .assertWidthEqualsTo(300.dp)
-        Truth.assertThat(textCoords).isNotNull()
+        assertThat(textCoords).isNotNull()
         textCoords?.let {
             withDensity(composeTestRule.density) {
                 val alignmentLines = it.providedAlignmentLines
 
-                Truth.assertThat(alignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(alignmentLines.get(LastBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(alignmentLines.get(FirstBaseline))
+                assertThat(alignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(alignmentLines.get(LastBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(alignmentLines.get(FirstBaseline))
                     .isNotEqualTo(alignmentLines.get(LastBaseline))
-                Truth.assertThat(it.position.y.round() + alignmentLines.getValue(FirstBaseline))
+                assertThat(it.position.y.round() + alignmentLines.getValue(FirstBaseline))
                     .isEqualTo(30.dp.toIntPx())
             }
         }
@@ -222,9 +222,9 @@
         sizes
             .assertHeightEqualsTo(68.dp)
             .assertWidthEqualsTo(300.dp)
-        Truth.assertThat(textCoords).isNotNull()
-        Truth.assertThat(buttonCoords).isNotNull()
-        Truth.assertThat(snackCoords).isNotNull()
+        assertThat(textCoords).isNotNull()
+        assertThat(buttonCoords).isNotNull()
+        assertThat(snackCoords).isNotNull()
         val localTextCoords = textCoords
         val localButtonCoords = buttonCoords
         val localSnackCoords = snackCoords
@@ -237,16 +237,16 @@
                 val buttonCenter =
                     buttonPositionInSnack.y + localButtonCoords.size.height / 2
 
-                Truth.assertThat(textAlignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(textAlignmentLines.get(LastBaseline)).isNotEqualTo(IntPx.Zero)
-                Truth.assertThat(textAlignmentLines.get(FirstBaseline))
+                assertThat(textAlignmentLines.get(FirstBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(textAlignmentLines.get(LastBaseline)).isNotEqualTo(IntPx.Zero)
+                assertThat(textAlignmentLines.get(FirstBaseline))
                     .isNotEqualTo(textAlignmentLines.get(LastBaseline))
-                Truth.assertThat(
+                assertThat(
                     localTextCoords.globalPosition.y.round() +
                             textAlignmentLines.getValue(FirstBaseline)
                 ).isEqualTo(30.dp.toIntPx())
 
-                Truth.assertThat(buttonCenter).isEqualTo(localSnackCoords.size.height / 2)
+                assertThat(buttonCenter).isEqualTo(localSnackCoords.size.height / 2)
             }
         }
     }
@@ -275,9 +275,9 @@
                 )
             }
         }
-        Truth.assertThat(textCoords).isNotNull()
-        Truth.assertThat(buttonCoords).isNotNull()
-        Truth.assertThat(snackCoords).isNotNull()
+        assertThat(textCoords).isNotNull()
+        assertThat(buttonCoords).isNotNull()
+        assertThat(snackCoords).isNotNull()
         val localTextCoords = textCoords
         val localButtonCoords = buttonCoords
         val localSnackCoords = snackCoords
@@ -290,21 +290,21 @@
                 val textPositionInSnack =
                     localSnackCoords.childToLocal(localTextCoords, PxPosition.Origin)
 
-                Truth.assertThat(
+                assertThat(
                     textPositionInSnack.y.round() + textAlignmentLines.getValue(FirstBaseline)
                 ).isEqualTo(30.dp.toIntPx())
 
-                Truth.assertThat(
+                assertThat(
                     buttonPositionInSnack.y.round() - textPositionInSnack.y.round() -
                             textAlignmentLines.getValue(LastBaseline)
                 ).isEqualTo(18.dp.toIntPx())
 
-                Truth.assertThat(
+                assertThat(
                     localSnackCoords.size.height.round() - buttonPositionInSnack.y.round() -
                             localButtonCoords.size.height.round()
                 ).isEqualTo(8.dp.toIntPx())
 
-                Truth.assertThat(
+                assertThat(
                     localSnackCoords.size.width.round() - buttonPositionInSnack.x.round() -
                             localButtonCoords.size.width.round()
                 ).isEqualTo(8.dp.toIntPx())
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceContentColorTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceContentColorTest.kt
index dd60ed2..2fe5eba 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceContentColorTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceContentColorTest.kt
@@ -22,7 +22,7 @@
 import androidx.ui.material.surface.Surface
 import androidx.ui.foundation.contentColor
 import androidx.ui.test.createComposeRule
-import org.junit.Assert.assertEquals
+import com.google.common.truth.Truth.assertThat
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -40,15 +40,10 @@
         composeTestRule.setContent {
             MaterialTheme {
                 Surface(color = MaterialTheme.colors().primary) {
-                    assertEquals(
-                        MaterialTheme.colors().onPrimary,
-                        contentColor()
-                    )
-
-                    assertEquals(
-                        MaterialTheme.colors().onPrimary,
-                        currentTextStyle().color
-                    )
+                    assertThat(contentColor())
+                        .isEqualTo(MaterialTheme.colors().onPrimary)
+                    assertThat(currentTextStyle().color)
+                        .isEqualTo(MaterialTheme.colors().onPrimary)
                 }
             }
         }
@@ -59,15 +54,10 @@
         composeTestRule.setContent {
             MaterialTheme {
                 Surface(color = MaterialTheme.colors().secondary) {
-                    assertEquals(
-                        MaterialTheme.colors().onSecondary,
-                        contentColor()
-                    )
-
-                    assertEquals(
-                        MaterialTheme.colors().onSecondary,
-                        currentTextStyle().color
-                    )
+                    assertThat(contentColor())
+                        .isEqualTo(MaterialTheme.colors().onSecondary)
+                    assertThat(currentTextStyle().color)
+                        .isEqualTo(MaterialTheme.colors().onSecondary)
                 }
             }
         }
@@ -78,15 +68,10 @@
         composeTestRule.setContent {
             MaterialTheme {
                 Surface(color = MaterialTheme.colors().background) {
-                    assertEquals(
-                        MaterialTheme.colors().onBackground,
-                        contentColor()
-                    )
-
-                    assertEquals(
-                        MaterialTheme.colors().onBackground,
-                        currentTextStyle().color
-                    )
+                    assertThat(contentColor())
+                        .isEqualTo(MaterialTheme.colors().onBackground)
+                    assertThat(currentTextStyle().color)
+                        .isEqualTo(MaterialTheme.colors().onBackground)
                 }
             }
         }
@@ -97,15 +82,10 @@
         composeTestRule.setContent {
             MaterialTheme {
                 Surface(color = MaterialTheme.colors().surface) {
-                    assertEquals(
-                        MaterialTheme.colors().onSurface,
-                        contentColor()
-                    )
-
-                    assertEquals(
-                        MaterialTheme.colors().onSurface,
-                        currentTextStyle().color
-                    )
+                    assertThat(contentColor())
+                        .isEqualTo(MaterialTheme.colors().onSurface)
+                    assertThat(currentTextStyle().color)
+                        .isEqualTo(MaterialTheme.colors().onSurface)
                 }
             }
         }
@@ -116,16 +96,8 @@
         composeTestRule.setContent {
             MaterialTheme {
                 Surface(color = Color.Yellow) {
-                    assertEquals(
-                        // Default value of contentColor() is black
-                        Color.Black,
-                        contentColor()
-                    )
-
-                    assertEquals(
-                        Color.Black,
-                        currentTextStyle().color
-                    )
+                    assertThat(contentColor()).isEqualTo(Color.Black)
+                    assertThat(currentTextStyle().color).isEqualTo(Color.Black)
                 }
             }
         }
@@ -140,15 +112,10 @@
                     // This surface should inherit the parent contentColor, as yellow is not part
                     // of the theme
                     Surface(color = Color.Yellow) {
-                        assertEquals(
-                            MaterialTheme.colors().onSurface,
-                            contentColor()
-                        )
-
-                        assertEquals(
-                            MaterialTheme.colors().onSurface,
-                            currentTextStyle().color
-                        )
+                        assertThat(contentColor())
+                            .isEqualTo(MaterialTheme.colors().onSurface)
+                        assertThat(currentTextStyle().color)
+                            .isEqualTo(MaterialTheme.colors().onSurface)
                     }
                 }
             }
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
index 3337f45..7339406 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
@@ -40,7 +40,7 @@
 import androidx.ui.test.doClick
 import androidx.ui.test.findAll
 import androidx.ui.test.isInMutuallyExclusiveGroup
-import com.google.common.truth.Truth
+import com.google.common.truth.Truth.assertThat
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -108,8 +108,7 @@
         var tabRowCoords: LayoutCoordinates? = null
         var indicatorCoords: LayoutCoordinates? = null
 
-        composeTestRule
-            .setMaterialContent {
+        composeTestRule.setMaterialContent {
                 // TODO: Go back to delegate syntax when b/141741358 is fixed
                 val (state, setState) = state { 0 }
                 val titles = listOf("TAB 1", "TAB 2")
@@ -137,37 +136,36 @@
                 }
             }
 
-        val tabRowWidth = tabRowCoords!!.size.width
-        val tabRowHeight = tabRowCoords!!.size.height
+        val (tabRowWidth, tabRowHeight) = composeTestRule.runOnIdleComposeWithDensity {
+            val tabRowWidth = tabRowCoords!!.size.width
+            val tabRowHeight = tabRowCoords!!.size.height
 
-        // Indicator should be placed in the bottom left of the first tab
-        withDensity(composeTestRule.density) {
             val indicatorPositionX = indicatorCoords!!.localToGlobal(PxPosition.Origin).x
             val expectedPositionX = 0.dp.toPx()
-            Truth.assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
+            assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
 
             val indicatorPositionY = indicatorCoords!!.localToGlobal(PxPosition.Origin).y
             val expectedPositionY = tabRowHeight - indicatorHeight.toIntPx().toPx()
-            Truth.assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+            assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+
+            tabRowWidth to tabRowHeight
         }
 
         // Click the second tab
         findAll { isInMutuallyExclusiveGroup }[1].doClick()
 
-        // TODO: we aren't correctly waiting for recompositions after clicking, so we need to wait
-        // again
-        findAll { isInMutuallyExclusiveGroup }
-
         // Indicator should now be placed in the bottom left of the second tab, so its x coordinate
         // should be in the middle of the TabRow
-        withDensity(composeTestRule.density) {
-            val indicatorPositionX = indicatorCoords!!.localToGlobal(PxPosition.Origin).x
-            val expectedPositionX = tabRowWidth / 2
-            Truth.assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
+        composeTestRule.runOnIdleCompose {
+            withDensity(composeTestRule.density) {
+                val indicatorPositionX = indicatorCoords!!.localToGlobal(PxPosition.Origin).x
+                val expectedPositionX = tabRowWidth / 2
+                assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
 
-            val indicatorPositionY = indicatorCoords!!.localToGlobal(PxPosition.Origin).y
-            val expectedPositionY = tabRowHeight - indicatorHeight.toIntPx().toPx()
-            Truth.assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+                val indicatorPositionY = indicatorCoords!!.localToGlobal(PxPosition.Origin).y
+                val expectedPositionY = tabRowHeight - indicatorHeight.toIntPx().toPx()
+                assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+            }
         }
     }
 
@@ -179,71 +177,64 @@
         var tabRowCoords: LayoutCoordinates? = null
         var indicatorCoords: LayoutCoordinates? = null
 
-        composeTestRule
-            .setMaterialContent {
-                // TODO: Go back to delegate syntax when b/141741358 is fixed
-                val (state, setState) = state { 0 }
-                val titles = listOf("TAB 1", "TAB 2")
+        composeTestRule.setMaterialContent {
+            // TODO: Go back to delegate syntax when b/141741358 is fixed
+            val (state, setState) = state { 0 }
+            val titles = listOf("TAB 1", "TAB 2")
 
-                val indicatorContainer = @Composable { tabPositions: List<TabRow.TabPosition> ->
-                    TabRow.IndicatorContainer(tabPositions, state) {
-                        OnChildPositioned({ indicatorCoords = it }) {
-                            ColoredRect(Color.Red, height = indicatorHeight)
-                        }
-                    }
-                }
-
-                Container(alignment = Alignment.TopCenter) {
-                    OnChildPositioned({ tabRowCoords = it }) {
-                        TabRow(
-                            items = titles,
-                            scrollable = true,
-                            selectedIndex = state,
-                            indicatorContainer = indicatorContainer
-                        ) { index, text ->
-                            Tab(text = text, selected = state == index) {
-                                setState(index)
-                            }
-                        }
+            val indicatorContainer = @Composable { tabPositions: List<TabRow.TabPosition> ->
+                TabRow.IndicatorContainer(tabPositions, state) {
+                    OnChildPositioned({ indicatorCoords = it }) {
+                        ColoredRect(Color.Red, height = indicatorHeight)
                     }
                 }
             }
 
-        val tabRowHeight = tabRowCoords!!.size.height
+            Container(alignment = Alignment.TopCenter) {
+                OnChildPositioned({ tabRowCoords = it }) {
+                    TabRow(
+                        items = titles,
+                        scrollable = true,
+                        selectedIndex = state,
+                        indicatorContainer = indicatorContainer
+                    ) { index, text ->
+                        Tab(text = text, selected = state == index) {
+                            setState(index)
+                        }
+                    }
+                }
+            }
+        }
 
-        // Indicator is drawn in a recomposition, so wait until we recompose and are stable before
-        // running assertions
-        findAll { isInMutuallyExclusiveGroup }
+        val tabRowHeight = composeTestRule.runOnIdleComposeWithDensity {
+            val tabRowHeight = tabRowCoords!!.size.height
 
-        // Indicator should be placed in the bottom left of the first tab
-        withDensity(composeTestRule.density) {
+            // Indicator should be placed in the bottom left of the first tab
             val indicatorPositionX = indicatorCoords!!.localToGlobal(PxPosition.Origin).x
             // Tabs in a scrollable tab row are offset 52.dp from each end
             val expectedPositionX = scrollableTabRowOffset.toIntPx().toPx()
-            Truth.assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
+            assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
 
             val indicatorPositionY = indicatorCoords!!.localToGlobal(PxPosition.Origin).y
             val expectedPositionY = tabRowHeight - indicatorHeight.toIntPx().toPx()
-            Truth.assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+            assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+
+            tabRowHeight
         }
 
         // Click the second tab
         findAll { isInMutuallyExclusiveGroup }[1].doClick()
 
-        // TODO: we aren't correctly waiting for recompositions after clicking, so we need to wait
-        // again
-        findAll { isInMutuallyExclusiveGroup }
-
         // Indicator should now be placed in the bottom left of the second tab, so its x coordinate
         // should be in the middle of the TabRow
-        withDensity(composeTestRule.density) {
+        composeTestRule.runOnIdleComposeWithDensity {
             val indicatorPositionX = indicatorCoords!!.localToGlobal(PxPosition.Origin).x
             val expectedPositionX = (scrollableTabRowOffset + minimumTabWidth).toIntPx().toPx()
-            Truth.assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
+            assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
 
             val indicatorPositionY = indicatorCoords!!.localToGlobal(PxPosition.Origin).y
             val expectedPositionY = tabRowHeight - indicatorHeight.toIntPx().toPx()
-            Truth.assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
+            assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
         }
     }
 
diff --git a/ui/ui-material/src/test/java/androidx/ui/material/BottomAppBarRoundedEdgesTest.kt b/ui/ui-material/src/test/java/androidx/ui/material/BottomAppBarRoundedEdgesTest.kt
index 56773ca..2037c2b 100644
--- a/ui/ui-material/src/test/java/androidx/ui/material/BottomAppBarRoundedEdgesTest.kt
+++ b/ui/ui-material/src/test/java/androidx/ui/material/BottomAppBarRoundedEdgesTest.kt
@@ -15,7 +15,7 @@
  */
 package androidx.ui.material
 
-import com.google.common.truth.Truth
+import com.google.common.truth.Truth.assertThat
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.JUnit4
@@ -51,8 +51,8 @@
         val expectedX = -4.16f
         val expectedY = 2.76f
 
-        Truth.assertThat(calculatedX).isWithin(0.01f).of(expectedX)
-        Truth.assertThat(calculatedY).isWithin(0.01f).of(expectedY)
+        assertThat(calculatedX).isWithin(0.01f).of(expectedX)
+        assertThat(calculatedY).isWithin(0.01f).of(expectedY)
     }
 
     @Test
@@ -68,8 +68,8 @@
         val expectedX = -4.96f
         val expectedY = 0.59f
 
-        Truth.assertThat(calculatedX).isWithin(0.01f).of(expectedX)
-        Truth.assertThat(calculatedY).isWithin(0.01f).of(expectedY)
+        assertThat(calculatedX).isWithin(0.01f).of(expectedX)
+        assertThat(calculatedY).isWithin(0.01f).of(expectedY)
     }
 
     @Test
@@ -85,8 +85,8 @@
         val expectedX = -4.33f
         val expectedY = -2.49f
 
-        Truth.assertThat(calculatedX).isWithin(0.01f).of(expectedX)
-        Truth.assertThat(calculatedY).isWithin(0.01f).of(expectedY)
+        assertThat(calculatedX).isWithin(0.01f).of(expectedX)
+        assertThat(calculatedY).isWithin(0.01f).of(expectedY)
     }
 
     @Test
@@ -102,7 +102,7 @@
         val expectedX = -2.72f
         val expectedY = 4.19f
 
-        Truth.assertThat(calculatedX).isWithin(0.01f).of(expectedX)
-        Truth.assertThat(calculatedY).isWithin(0.01f).of(expectedY)
+        assertThat(calculatedX).isWithin(0.01f).of(expectedX)
+        assertThat(calculatedY).isWithin(0.01f).of(expectedY)
     }
 }