AdevintaSpain / AdevintaSpain/Barista
Tests like *_breaksWhenNeeded are broken
Abierto
bug
wip
- Lenguaje dominante
- Kotlin
- Estrellas
- 1.7k
- Forks
- 119
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
There are some tests like `checkEnabledView_breaksWhenNeeded` with code like this:
```java
try {
assertEnabled(R.id.disabled_button);
fail();
} catch (Throwable expected) {
}
```
They're broken because they **always pass**. If `assertEnabled` doesn't fail, `fail()` will be invoked, which launches an `AssertionError`. The funny thing is that the `catch (Throwable expected)` also catches `AssertionError`, so the test will always be green.
It's as easy as changing the catch type to something like `RuntimeException`, which doesn't include `AssertionError`.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.