AdevintaSpain / AdevintaSpain/Barista

Tests like *_breaksWhenNeeded are broken

Abierto
#197 4 comentarios 0 reacciones 0 asignados Ver en GitHub
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

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.