Proper (and Simplified) Testing of a Data SourceHow do I test a private function or a class that has private methods, fields or inner classes?How do you unit test private methods?JavaScript unit test tools for TDDWhere can I find Android source code online?How do I pass data between Activities in Android application?Is there a way to get the source code from an APK file?Proper use cases for Android UserManager.isUserAGoat()?Nested classes for TDD?How to increase test coverage in private methodHow to handle mocked RxJava2 observable throwing exception in unit test

Is it OK to accept a job opportunity while planning on not taking it?

Is there a way to shorten this while condition?

Higher calorie ice cream

What kind of world would drive brains to evolve high-throughput sensory?

As a DM of a 4-player group, would it be appropriate for me to run a private 1-on-1 session so that one PC can act secretly?

Finding number of days per ID in table using ArcPy?

Wiring IKEA light fixture into old fixture

What is a plausible power source to indefinitely sustain a space station?

Impact of throwing away fruit waste on a peak > 3200 m above a glacier

My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?

What does a black-and-white Puerto Rican flag signify?

Xcode 10.3 Installation

Found old paper shares of Motorola Inc that has since been broken up

If hash functions append the length, why does length extension attack work?

How am I supposed to put out fires?

Strange LED behavior: Why is there a voltage over the LED with only one wire connected to it?

Pass USB 3.0 connection through D-SUB connector

Bounded Torsion, without Mazur’s Theorem

What gave NASA the confidence for a translunar injection in Apollo 8?

Why is the UH-60 tail rotor canted?

"It is what it is" in French

Find All Entire Functions that Satisfy Some Condition

What does the following chess proverb mean: "Chess is a sea where a gnat may drink from and an elephant may bathe in."

Does downing a character at the start of its turn require an immediate Death Saving Throw?



Proper (and Simplified) Testing of a Data Source


How do I test a private function or a class that has private methods, fields or inner classes?How do you unit test private methods?JavaScript unit test tools for TDDWhere can I find Android source code online?How do I pass data between Activities in Android application?Is there a way to get the source code from an APK file?Proper use cases for Android UserManager.isUserAGoat()?Nested classes for TDD?How to increase test coverage in private methodHow to handle mocked RxJava2 observable throwing exception in unit test






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I've recently started getting into testing (TDD) and was wondering if anyone can shed some light into the practice I'm doing. For example, I'm checking if the location provider is available, I implement a contract (data source) class and a wrapper, like so:



LocationDataSource.kt



interface LocationDataSource 

fun isAvailable(): Observable<Boolean>




LocationUtil.kt



class LocationUtil(manager: LocationManager): LocationDataSource 

private var isAvailableSubject: BehaviorSubject<Boolean> =
BehaviorSubject.createDefault(manager.isProviderEnabled(provider))

override fun isAvailable(): Observable<Boolean> = locationSubject




Now, when testing, I'm not sure how to proceed. First thing that I did was mocking the LocationManager and the isProviderEnabled method:



class LocationTest 

@Mock
private lateinit var context: Context

private lateinit var dataSource: LocationDataSource
private lateinit var manager: LocationManager

private val observer = TestObserver<Boolean>()

@Before
@Throws(Exception::class)
fun setUp()
MockitoAnnotations.initMocks(this)

// override schedulers here

`when`(context.getSystemService(LocationManager::class.java))
.thenReturn(mock(LocationManager::class.java))

manager = context.getSystemService(LocationManager::class.java)
dataSource = LocationUtil(manager)


@Test
fun isProviderDisabled_ShouldReturnFalse()
// Given
`when`(manager.isProviderEnabled(anyString())).thenReturn(false)

// When
dataSource.isLocationAvailable().subscribe(observer)

// Then
observer.assertNoErrors()
observer.assertValue(false)





This works. However, during my research on how to do this and that, the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.



So I figured, would it be best (and still within the TDD scope) to just test the contract (LocationDataSource) itself? Mocking dataSource and then replacing the test above with:



@Test
fun isProviderDisable_ShouldReturnFalse()
// Given
`when`(dataSource.isLocationAvailable()).thenReturn(false)

// When
dataSource.isLocationAvailable().subscribe(observer)

// Then
observer.assertNoErrors()
observer.assertValue(false)



This would (obviously) provide the same result without going through the trouble of mocking a LocationManager. But, I think this defeats the purpose of the test -- since it only focuses on the contract itself -- and not the actual class that uses it.



I still think that maybe the first practice is still the proper way. That initially, it just takes time to familiarize with the mocking of Android classes. But I would love to know what the experts on TDD think.










share|improve this question




























    0















    I've recently started getting into testing (TDD) and was wondering if anyone can shed some light into the practice I'm doing. For example, I'm checking if the location provider is available, I implement a contract (data source) class and a wrapper, like so:



    LocationDataSource.kt



    interface LocationDataSource 

    fun isAvailable(): Observable<Boolean>




    LocationUtil.kt



    class LocationUtil(manager: LocationManager): LocationDataSource 

    private var isAvailableSubject: BehaviorSubject<Boolean> =
    BehaviorSubject.createDefault(manager.isProviderEnabled(provider))

    override fun isAvailable(): Observable<Boolean> = locationSubject




    Now, when testing, I'm not sure how to proceed. First thing that I did was mocking the LocationManager and the isProviderEnabled method:



    class LocationTest 

    @Mock
    private lateinit var context: Context

    private lateinit var dataSource: LocationDataSource
    private lateinit var manager: LocationManager

    private val observer = TestObserver<Boolean>()

    @Before
    @Throws(Exception::class)
    fun setUp()
    MockitoAnnotations.initMocks(this)

    // override schedulers here

    `when`(context.getSystemService(LocationManager::class.java))
    .thenReturn(mock(LocationManager::class.java))

    manager = context.getSystemService(LocationManager::class.java)
    dataSource = LocationUtil(manager)


    @Test
    fun isProviderDisabled_ShouldReturnFalse()
    // Given
    `when`(manager.isProviderEnabled(anyString())).thenReturn(false)

    // When
    dataSource.isLocationAvailable().subscribe(observer)

    // Then
    observer.assertNoErrors()
    observer.assertValue(false)





    This works. However, during my research on how to do this and that, the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.



    So I figured, would it be best (and still within the TDD scope) to just test the contract (LocationDataSource) itself? Mocking dataSource and then replacing the test above with:



    @Test
    fun isProviderDisable_ShouldReturnFalse()
    // Given
    `when`(dataSource.isLocationAvailable()).thenReturn(false)

    // When
    dataSource.isLocationAvailable().subscribe(observer)

    // Then
    observer.assertNoErrors()
    observer.assertValue(false)



    This would (obviously) provide the same result without going through the trouble of mocking a LocationManager. But, I think this defeats the purpose of the test -- since it only focuses on the contract itself -- and not the actual class that uses it.



    I still think that maybe the first practice is still the proper way. That initially, it just takes time to familiarize with the mocking of Android classes. But I would love to know what the experts on TDD think.










    share|improve this question
























      0












      0








      0








      I've recently started getting into testing (TDD) and was wondering if anyone can shed some light into the practice I'm doing. For example, I'm checking if the location provider is available, I implement a contract (data source) class and a wrapper, like so:



      LocationDataSource.kt



      interface LocationDataSource 

      fun isAvailable(): Observable<Boolean>




      LocationUtil.kt



      class LocationUtil(manager: LocationManager): LocationDataSource 

      private var isAvailableSubject: BehaviorSubject<Boolean> =
      BehaviorSubject.createDefault(manager.isProviderEnabled(provider))

      override fun isAvailable(): Observable<Boolean> = locationSubject




      Now, when testing, I'm not sure how to proceed. First thing that I did was mocking the LocationManager and the isProviderEnabled method:



      class LocationTest 

      @Mock
      private lateinit var context: Context

      private lateinit var dataSource: LocationDataSource
      private lateinit var manager: LocationManager

      private val observer = TestObserver<Boolean>()

      @Before
      @Throws(Exception::class)
      fun setUp()
      MockitoAnnotations.initMocks(this)

      // override schedulers here

      `when`(context.getSystemService(LocationManager::class.java))
      .thenReturn(mock(LocationManager::class.java))

      manager = context.getSystemService(LocationManager::class.java)
      dataSource = LocationUtil(manager)


      @Test
      fun isProviderDisabled_ShouldReturnFalse()
      // Given
      `when`(manager.isProviderEnabled(anyString())).thenReturn(false)

      // When
      dataSource.isLocationAvailable().subscribe(observer)

      // Then
      observer.assertNoErrors()
      observer.assertValue(false)





      This works. However, during my research on how to do this and that, the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.



      So I figured, would it be best (and still within the TDD scope) to just test the contract (LocationDataSource) itself? Mocking dataSource and then replacing the test above with:



      @Test
      fun isProviderDisable_ShouldReturnFalse()
      // Given
      `when`(dataSource.isLocationAvailable()).thenReturn(false)

      // When
      dataSource.isLocationAvailable().subscribe(observer)

      // Then
      observer.assertNoErrors()
      observer.assertValue(false)



      This would (obviously) provide the same result without going through the trouble of mocking a LocationManager. But, I think this defeats the purpose of the test -- since it only focuses on the contract itself -- and not the actual class that uses it.



      I still think that maybe the first practice is still the proper way. That initially, it just takes time to familiarize with the mocking of Android classes. But I would love to know what the experts on TDD think.










      share|improve this question














      I've recently started getting into testing (TDD) and was wondering if anyone can shed some light into the practice I'm doing. For example, I'm checking if the location provider is available, I implement a contract (data source) class and a wrapper, like so:



      LocationDataSource.kt



      interface LocationDataSource 

      fun isAvailable(): Observable<Boolean>




      LocationUtil.kt



      class LocationUtil(manager: LocationManager): LocationDataSource 

      private var isAvailableSubject: BehaviorSubject<Boolean> =
      BehaviorSubject.createDefault(manager.isProviderEnabled(provider))

      override fun isAvailable(): Observable<Boolean> = locationSubject




      Now, when testing, I'm not sure how to proceed. First thing that I did was mocking the LocationManager and the isProviderEnabled method:



      class LocationTest 

      @Mock
      private lateinit var context: Context

      private lateinit var dataSource: LocationDataSource
      private lateinit var manager: LocationManager

      private val observer = TestObserver<Boolean>()

      @Before
      @Throws(Exception::class)
      fun setUp()
      MockitoAnnotations.initMocks(this)

      // override schedulers here

      `when`(context.getSystemService(LocationManager::class.java))
      .thenReturn(mock(LocationManager::class.java))

      manager = context.getSystemService(LocationManager::class.java)
      dataSource = LocationUtil(manager)


      @Test
      fun isProviderDisabled_ShouldReturnFalse()
      // Given
      `when`(manager.isProviderEnabled(anyString())).thenReturn(false)

      // When
      dataSource.isLocationAvailable().subscribe(observer)

      // Then
      observer.assertNoErrors()
      observer.assertValue(false)





      This works. However, during my research on how to do this and that, the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.



      So I figured, would it be best (and still within the TDD scope) to just test the contract (LocationDataSource) itself? Mocking dataSource and then replacing the test above with:



      @Test
      fun isProviderDisable_ShouldReturnFalse()
      // Given
      `when`(dataSource.isLocationAvailable()).thenReturn(false)

      // When
      dataSource.isLocationAvailable().subscribe(observer)

      // Then
      observer.assertNoErrors()
      observer.assertValue(false)



      This would (obviously) provide the same result without going through the trouble of mocking a LocationManager. But, I think this defeats the purpose of the test -- since it only focuses on the contract itself -- and not the actual class that uses it.



      I still think that maybe the first practice is still the proper way. That initially, it just takes time to familiarize with the mocking of Android classes. But I would love to know what the experts on TDD think.







      android tdd android-testing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 14:07









      AL.AL.

      26.2k8 gold badges73 silver badges202 bronze badges




      26.2k8 gold badges73 silver badges202 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Working backwards... this looks a little weird:



          // Given
          `when`(dataSource.isLocationAvailable()).thenReturn(false)

          // When
          dataSource.isLocationAvailable().subscribe(observer)


          You've got a mock(LocationDataSource) talking to a TestObserver. That test isn't completely without value, but if I'm not mistaken running tells you nothing new; if the code compiles, then the contract is satisfied.



          In a language where you have reliable type checking, executed tests should have a test subject that is a production implementation. So in your second example, if observer were a test subject, that would be "fine".



          I wouldn't pass that test in a code review -- unless there is spooky recursion at a distance going on, there's no reason to mock a method call that you are going to be making in the test itself.



          // When
          BehaviorSubject.createDefault(false).subscribe(testSubject);



          the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.




          Right - your current design is fighting with you when you try to test it. That's a symptom; your job as the designer is to identify the problem.



          In this case, the code you are trying to test it too tightly coupled to the LocationManager. It is common to create an interface/contract that you can hide a specific implementation behind. Sometimes this pattern is called a seam.



          LocationManager::isProviderEnabled, from the outside, is just a function that takes a String and returns a boolean. So instead of writing your method in terms of the LocationManager, write it in terms of the capability that it will give you:



          class LocationUtil(isProviderEnabled: (String) -> boolean ) : LocationDataSource 

          private var isAvailableSubject: BehaviorSubject<Boolean> =
          BehaviorSubject.createDefault(isProviderEnabled(provider))

          override fun isAvailable(): Observable<Boolean> = locationSubject



          In effect, we're trying to push the "hard to test" bits closer to the boundaries, where we'll rely on other techniques to address the risks.






          share|improve this answer























          • "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

            – AL.
            Mar 27 at 7:30










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359190%2fproper-and-simplified-testing-of-a-data-source%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Working backwards... this looks a little weird:



          // Given
          `when`(dataSource.isLocationAvailable()).thenReturn(false)

          // When
          dataSource.isLocationAvailable().subscribe(observer)


          You've got a mock(LocationDataSource) talking to a TestObserver. That test isn't completely without value, but if I'm not mistaken running tells you nothing new; if the code compiles, then the contract is satisfied.



          In a language where you have reliable type checking, executed tests should have a test subject that is a production implementation. So in your second example, if observer were a test subject, that would be "fine".



          I wouldn't pass that test in a code review -- unless there is spooky recursion at a distance going on, there's no reason to mock a method call that you are going to be making in the test itself.



          // When
          BehaviorSubject.createDefault(false).subscribe(testSubject);



          the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.




          Right - your current design is fighting with you when you try to test it. That's a symptom; your job as the designer is to identify the problem.



          In this case, the code you are trying to test it too tightly coupled to the LocationManager. It is common to create an interface/contract that you can hide a specific implementation behind. Sometimes this pattern is called a seam.



          LocationManager::isProviderEnabled, from the outside, is just a function that takes a String and returns a boolean. So instead of writing your method in terms of the LocationManager, write it in terms of the capability that it will give you:



          class LocationUtil(isProviderEnabled: (String) -> boolean ) : LocationDataSource 

          private var isAvailableSubject: BehaviorSubject<Boolean> =
          BehaviorSubject.createDefault(isProviderEnabled(provider))

          override fun isAvailable(): Observable<Boolean> = locationSubject



          In effect, we're trying to push the "hard to test" bits closer to the boundaries, where we'll rely on other techniques to address the risks.






          share|improve this answer























          • "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

            – AL.
            Mar 27 at 7:30















          1














          Working backwards... this looks a little weird:



          // Given
          `when`(dataSource.isLocationAvailable()).thenReturn(false)

          // When
          dataSource.isLocationAvailable().subscribe(observer)


          You've got a mock(LocationDataSource) talking to a TestObserver. That test isn't completely without value, but if I'm not mistaken running tells you nothing new; if the code compiles, then the contract is satisfied.



          In a language where you have reliable type checking, executed tests should have a test subject that is a production implementation. So in your second example, if observer were a test subject, that would be "fine".



          I wouldn't pass that test in a code review -- unless there is spooky recursion at a distance going on, there's no reason to mock a method call that you are going to be making in the test itself.



          // When
          BehaviorSubject.createDefault(false).subscribe(testSubject);



          the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.




          Right - your current design is fighting with you when you try to test it. That's a symptom; your job as the designer is to identify the problem.



          In this case, the code you are trying to test it too tightly coupled to the LocationManager. It is common to create an interface/contract that you can hide a specific implementation behind. Sometimes this pattern is called a seam.



          LocationManager::isProviderEnabled, from the outside, is just a function that takes a String and returns a boolean. So instead of writing your method in terms of the LocationManager, write it in terms of the capability that it will give you:



          class LocationUtil(isProviderEnabled: (String) -> boolean ) : LocationDataSource 

          private var isAvailableSubject: BehaviorSubject<Boolean> =
          BehaviorSubject.createDefault(isProviderEnabled(provider))

          override fun isAvailable(): Observable<Boolean> = locationSubject



          In effect, we're trying to push the "hard to test" bits closer to the boundaries, where we'll rely on other techniques to address the risks.






          share|improve this answer























          • "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

            – AL.
            Mar 27 at 7:30













          1












          1








          1







          Working backwards... this looks a little weird:



          // Given
          `when`(dataSource.isLocationAvailable()).thenReturn(false)

          // When
          dataSource.isLocationAvailable().subscribe(observer)


          You've got a mock(LocationDataSource) talking to a TestObserver. That test isn't completely without value, but if I'm not mistaken running tells you nothing new; if the code compiles, then the contract is satisfied.



          In a language where you have reliable type checking, executed tests should have a test subject that is a production implementation. So in your second example, if observer were a test subject, that would be "fine".



          I wouldn't pass that test in a code review -- unless there is spooky recursion at a distance going on, there's no reason to mock a method call that you are going to be making in the test itself.



          // When
          BehaviorSubject.createDefault(false).subscribe(testSubject);



          the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.




          Right - your current design is fighting with you when you try to test it. That's a symptom; your job as the designer is to identify the problem.



          In this case, the code you are trying to test it too tightly coupled to the LocationManager. It is common to create an interface/contract that you can hide a specific implementation behind. Sometimes this pattern is called a seam.



          LocationManager::isProviderEnabled, from the outside, is just a function that takes a String and returns a boolean. So instead of writing your method in terms of the LocationManager, write it in terms of the capability that it will give you:



          class LocationUtil(isProviderEnabled: (String) -> boolean ) : LocationDataSource 

          private var isAvailableSubject: BehaviorSubject<Boolean> =
          BehaviorSubject.createDefault(isProviderEnabled(provider))

          override fun isAvailable(): Observable<Boolean> = locationSubject



          In effect, we're trying to push the "hard to test" bits closer to the boundaries, where we'll rely on other techniques to address the risks.






          share|improve this answer













          Working backwards... this looks a little weird:



          // Given
          `when`(dataSource.isLocationAvailable()).thenReturn(false)

          // When
          dataSource.isLocationAvailable().subscribe(observer)


          You've got a mock(LocationDataSource) talking to a TestObserver. That test isn't completely without value, but if I'm not mistaken running tells you nothing new; if the code compiles, then the contract is satisfied.



          In a language where you have reliable type checking, executed tests should have a test subject that is a production implementation. So in your second example, if observer were a test subject, that would be "fine".



          I wouldn't pass that test in a code review -- unless there is spooky recursion at a distance going on, there's no reason to mock a method call that you are going to be making in the test itself.



          // When
          BehaviorSubject.createDefault(false).subscribe(testSubject);



          the time I spent figuring out how to mock the LocationManager was big enough to (I think) break one of the common rules in TDD -- a test implementation should not consume too much time.




          Right - your current design is fighting with you when you try to test it. That's a symptom; your job as the designer is to identify the problem.



          In this case, the code you are trying to test it too tightly coupled to the LocationManager. It is common to create an interface/contract that you can hide a specific implementation behind. Sometimes this pattern is called a seam.



          LocationManager::isProviderEnabled, from the outside, is just a function that takes a String and returns a boolean. So instead of writing your method in terms of the LocationManager, write it in terms of the capability that it will give you:



          class LocationUtil(isProviderEnabled: (String) -> boolean ) : LocationDataSource 

          private var isAvailableSubject: BehaviorSubject<Boolean> =
          BehaviorSubject.createDefault(isProviderEnabled(provider))

          override fun isAvailable(): Observable<Boolean> = locationSubject



          In effect, we're trying to push the "hard to test" bits closer to the boundaries, where we'll rely on other techniques to address the risks.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 3:05









          VoiceOfUnreasonVoiceOfUnreason

          24.3k2 gold badges23 silver badges54 bronze badges




          24.3k2 gold badges23 silver badges54 bronze badges












          • "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

            – AL.
            Mar 27 at 7:30

















          • "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

            – AL.
            Mar 27 at 7:30
















          "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

          – AL.
          Mar 27 at 7:30





          "running tells you nothing new;" -- Perfect way to describe the second scenario -- and pretty much most of what I've seen with unit tests (with Android at least). Thanks for suggesting the higher-order function as parameters and the link on boundaries, I'll test it out. I really think this would make it easier for me to test out different scenarios with the util class. What I'm wondering though is that is this the usual practice for Android. I've reviewed a number of tutorials and best practices but didn't find any (so far) that does it this way. Nonetheless, thank you very much.

          – AL.
          Mar 27 at 7:30








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359190%2fproper-and-simplified-testing-of-a-data-source%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해