This commit is contained in:
Johannes Mockenhaupt 2019-04-10 14:58:01 +02:00
parent a33afc99f6
commit cefee4827b
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -5,7 +5,7 @@ import org.junit.Test
class VersionCheckerUtilsKtTest {
@Test
fun findVersionMatches() {
fun findVersionMatchesRegularVersion() {
val buildGradle = """blabla
| android {
| aosenuthoae
@ -16,4 +16,25 @@ class VersionCheckerUtilsKtTest {
val detectedVersion: String? = buildGradle.byteInputStream().findVersion()
assertEquals("2.2.2", detectedVersion)
}
// 04. Break stuff.mp3 like it's 1999. Again. Pizza delivery! For i c wiener ...
//@Test
fun findVersionMatchesCustomVersion() {
val buildGradle = """blabla
| android {
| aosenuthoae
| }
| version = "2.2.2-nefarious-underground-mod"
| appName = "Aaoeu"
""".trimMargin()
val detectedVersion: String? = buildGradle.byteInputStream().findVersion()
assertEquals("2.2.2", detectedVersion)
}
@Test
fun findVersionMatchesDoesNotMatchErrorResponse() {
val buildGradle = """<html><body>Balls! No build.gradle here. Move along</body><html>"""
val detectedVersion: String? = buildGradle.byteInputStream().findVersion()
assertEquals(null, detectedVersion)
}
}