# Improving Android Tests with JUnit4

DevFeed: [Improving Android Tests with JUnit4](<https://devfeed.tech/articles/can-you-fix-the-test-28673.md>)

Original publisher: [Read original article](<https://jeroenmols.com/blog/2018/12/06/fixthetest/>)

Author: info@jeroenmols.com (Jeroen Mols)

Published: 2018-12-06T00:00:00Z

Content type: tutorial

Language: en

Sources: [Jeroen Mols](<https://devfeed.tech/sources/jeroen-mols.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [Android](<https://devfeed.tech/topics/android.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [blogs](<https://devfeed.tech/tags/blogs.md>), [cleancode](<https://devfeed.tech/tags/cleancode.md>), [code](<https://devfeed.tech/tags/code.md>), [exception](<https://devfeed.tech/tags/exception.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [inheritance](<https://devfeed.tech/tags/inheritance.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [mocking](<https://devfeed.tech/tags/mocking.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

This tutorial uses a quiz format to examine mistakes in Android tests. It explains replacing old JUnit3 syntax with JUnit4 annotations, using expected-exception annotations, and making mock-based tests fail for clearer, more specific reasons.

## Source excerpt

Learning from analyzing code is one of the greatest ways to improve your skills. Can you spot the mistakes in the tests below? This post brings a fun little quiz for both testing gurus as novices, with a deep dive into the how and why of awesome tests.