20 Unit Testing and Audio Playback
One reason MVVM architecture is so appealing is that it makes a critical programming practice easier: unit testing. Unit testing is the practice of writing small programs that verify the standalone behavior of each unit of your main app. Because BeatBox’s units are each classes, classes are what your unit tests will test.
In this chapter, you will finally play all of the .wav files you loaded in the previous chapter. As you build and integrate sound playback, you will write unit tests for your SoundViewModel’s integration with BeatBox.
Android’s audio APIs are low level, for the most part, but there is a tool practically tailor-made for the app you are writing: SoundPool. SoundPool can load ...