Android-Testing-With-Kotlin icon indicating copy to clipboard operation
Android-Testing-With-Kotlin copied to clipboard

Example migration of Android application from Java to Kotlin - DO NOT MERGE

Open dbacinski opened this issue 6 years ago • 0 comments

Migration findings and solved issues:

  • Java protected (package-private + inheritance) != Koltin protected (private + inheritance)
  • there is no package-private scope to hide classes inside of package and expose just a public interface
  • tests that verifies nulls are replaced with non-nullable Kotlin types
  • nullable view has to be guarded with .?, because smart cast does't work for var-s
  • builders can be replaced with constructor and named parameters
  • Mockito is failing on final classes (Kotlin default), can be fixed by Mock Maker
  • Mockito any() doesn't work for objects in Kotlin, alternative any() from mockito-kotlin can be used
  • when is a keyword in Kotlin, use BDDMockito.given() instead
  • Gradle annotationProcessor is replaced by kapt

Check Files changed tab to see files diff.

dbacinski avatar Nov 03 '17 20:11 dbacinski