Last active
September 2, 2019 15:59
-
-
Save JoseAlcerreca/387714aa9e04ac840b235cbaba6746bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2019 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
@Test | |
fun isLiveDataEmitting_observeForever() { | |
viewModel.setNewValue("foo") | |
// This works but can be improved. | |
viewModel.liveData2.observeForever { } | |
// Passes because it's not a result of a Transformation: | |
assertEquals(viewModel.liveData1.value, "foo") | |
// Passes because now it's being observed: | |
assertEquals(viewModel.liveData2.value, "FOO") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment