This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create a map of key/value pairs, called deps (deps) | |
ext.deps = [:] | |
//def means we're making a local variable. We'll use this map to build our deps key/value | |
//pairs below | |
def versions = [:] | |
versions.google_services = "4.3.3" | |
versions.firebase_analytics = "17.2.2" | |
versions.lifecycle = "2.0.0-rc01" | |
versions.constraint_layout = "2.0.0-alpha2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "com.vanniktech.android.junit.jacoco" | |
junitJacoco { | |
jacocoVersion = '0.8.5' | |
ignoreProjects = [] | |
excludes = [ | |
'**/R.class', | |
'**/R$*.class', | |
'**/*$$*', | |
'**/BuildConfig.*', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
apply from: 'versions.gradle' | |
addRepos(repositories) | |
dependencies { | |
classpath deps.android_gradle_plugin | |
classpath deps.kotlin.kotlin_gradle_plugin | |
classpath deps.jacoco_android | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'kotlin-kapt' | |
apply from: '../jacoco.gradle' | |
android { | |
compileSdkVersion build_versions.target_sdk | |
defaultConfig { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class ResultadoEvaluacion<out E, out V> { | |
data class Valor<out V>(val valor: V) : ResultadoEvaluacion<Nothing, V>() | |
data class Error<out E>(val error: E) : ResultadoEvaluacion<E, Nothing>() | |
companion object { | |
inline fun <V> build(function: () -> V): ResultadoEvaluacion<Exception, V> = | |
try { | |
Valor( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface EvaluadorUseCase { | |
suspend fun evaluar(expresion: String): ResultadoEvaluacion<Exception, String> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface EvaluadorExpresionUseCase { | |
suspend fun evaluarExpresion(expresion: String): ResultadoEvaluacion<Exception, String> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ValidadorUseCaseImpl : ValidadorUseCase { | |
override suspend fun validar(expresion: String): ResultadoEvaluacion<Exception, Boolean> { | |
TODO("Not yet implemented") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.runBlocking | |
import org.junit.Test | |
import org.junit.jupiter.api.Assertions.assertTrue | |
internal class ValidadorUseCaseImplTest { | |
private val mensajeExpresionNoValida = "Expresion No Valida." | |
private val validadorUseCase by lazy { | |
ValidadorUseCaseImpl() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class ErrorEvaluacion(mensaje: String? = null) : Exception(mensaje) { | |
class ErrorValidacion : ErrorEvaluacion("Expresion No Valida.") | |
} |
OlderNewer