# Cleancode

Published articles for Cleancode.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## 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.

## Why Some Applications Should Crash on Unhandled Exceptions

DevFeed: [Why Some Applications Should Crash on Unhandled Exceptions](<https://devfeed.tech/articles/why-your-app-should-crash-28655.md>)

Original publisher: [Read original article](<https://jeroenmols.com/blog/2017/03/08/appcrash/>)

Author: info@jeroenmols.com (Jeroen Mols)

Published: 2017-03-08T00:00:00Z

Content type: opinion

Language: en

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

Topics: [App](<https://devfeed.tech/topics/app.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [app](<https://devfeed.tech/tags/app.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [blogs](<https://devfeed.tech/tags/blogs.md>), [cleancode](<https://devfeed.tech/tags/cleancode.md>), [code](<https://devfeed.tech/tags/code.md>), [crash](<https://devfeed.tech/tags/crash.md>), [crashes](<https://devfeed.tech/tags/crashes.md>), [developers](<https://devfeed.tech/tags/developers.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [issue](<https://devfeed.tech/tags/issue.md>), [notify](<https://devfeed.tech/tags/notify.md>), [production](<https://devfeed.tech/tags/production.md>), [state](<https://devfeed.tech/tags/state.md>), [tips](<https://devfeed.tech/tags/tips.md>), [trace](<https://devfeed.tech/tags/trace.md>)

### AI overview

This article argues that applications should sometimes crash when they reach an unsupported state. It uses null checks as an example, explaining that excessive checks can clutter code and conceal deeper issues, while unhandled exceptions can expose problems through crashes, traces, and crash reporting.

### Source excerpt

Too many times I've seen developers trying to avoid crashes at all cost. But are unhandled exceptions really that bad? And are null checks really the answer?

## Write awesome unit tests

DevFeed: [Write awesome unit tests](<https://devfeed.tech/articles/write-awesome-unit-tests-28654.md>)

Original publisher: [Read original article](<https://jeroenmols.com/blog/2017/02/16/unittests/>)

Author: info@jeroenmols.com (Jeroen Mols)

Published: 2017-02-16T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [blogs](<https://devfeed.tech/tags/blogs.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [cleancode](<https://devfeed.tech/tags/cleancode.md>), [production](<https://devfeed.tech/tags/production.md>), [refactor](<https://devfeed.tech/tags/refactor.md>), [regression](<https://devfeed.tech/tags/regression.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>), [tips](<https://devfeed.tech/tags/tips.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

A tutorial presents rules for writing maintainable unit tests: run them very quickly and frequently, isolate business logic from UI, database, and network tests, and keep each test small and focused on one failure cause.

### Source excerpt

If you can code, you can also write unit tests. Writing awesome tests on the other hand is a different story. Don't fool yourself: Unit testing code is production code that you will need to maintain, refactor and build upon for years to come.

## A naming convention for Android XML resources

DevFeed: [A naming convention for Android XML resources](<https://devfeed.tech/articles/a-successful-xml-naming-convention-28643.md>)

Original publisher: [Read original article](<https://jeroenmols.com/blog/2016/03/07/resourcenaming/>)

Author: info@jeroenmols.com (Jeroen Mols)

Published: 2016-03-07T00:00:00Z

Content type: tutorial

Language: en

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

Topics: [Android](<https://devfeed.tech/topics/android.md>), [XML](<https://devfeed.tech/topics/xml.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [ide](<https://devfeed.tech/topics/ide.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [autocomplete](<https://devfeed.tech/tags/autocomplete.md>), [blogs](<https://devfeed.tech/tags/blogs.md>), [cheat-sheet](<https://devfeed.tech/tags/cheat-sheet.md>), [cleancode](<https://devfeed.tech/tags/cleancode.md>), [ide](<https://devfeed.tech/tags/ide.md>), [ordering](<https://devfeed.tech/tags/ordering.md>), [resources](<https://devfeed.tech/tags/resources.md>), [xml](<https://devfeed.tech/tags/xml.md>)

### AI overview

This tutorial proposes a naming convention for Android XML resources to make resource lookup, ordering, autocomplete, organization, and resource ID typing more predictable. It also discusses the convention's advantages and limitations.

### Source excerpt

Do you remember the last time you had to dig into strings.xml to find the right String to use? Or that you manually had to go over all drawables to find the one you needed?