This example is intended as a starting point for anyone planning develop Android applications using Scala. Its learning objectives are:
- Android application development using Scala
- using the Simple Build Tool (sbt) for Scala in conjunction with pfn's well-maintained plugin
- using IntelliJ IDEA
- Android application architecture for testability and maintainability
- Dependency Inversion Principle (DIP)
- Model-View-Adapter architectural pattern
- Separation of Android activity into event-handling and lifecycle management
- Use of Scala primarily as a "better Java" (including mutable state)
- Effective testing
- Unit testing and Behavior-Driven Development (BDD) with ScalaTest
- Mock objects with Mockito
- Functional testing (out-of-container) using Robolectric
- Existing isolation frameworks for Scala do not seem to handle dependencies added using the stackable trait (mixin) idiom. It is usually necessary to create one's own fakes, whether they are used as stubs or mocks.
- Robolectric-based tests cannot run in parallel, though regular unit tests can (and usually should). Therefore, it is easiest just to stack all abstract test superclasses (realized as stackable traits) onto a single concrete subclass (the Robolectric suite).
Please refer to these notes for details.