This repository has been archived by the owner on Dec 7, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
85 additions
and
9 deletions.
There are no files selected for viewing
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
69 changes: 69 additions & 0 deletions
69
composer/src/test/kotlin/com/gojuno/composer/LogLineParserSpec.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.gojuno.composer | ||
|
||
import org.assertj.core.api.Assertions.assertThat | ||
import org.jetbrains.spek.api.Spek | ||
import org.jetbrains.spek.api.dsl.context | ||
import org.jetbrains.spek.api.dsl.it | ||
|
||
class LogLineParserSpec : Spek({ | ||
|
||
context("parse TestRunner log line with long prefix") { | ||
|
||
context("parse started log") { | ||
val args by memoized { | ||
"04-06 00:25:49.747 28632 28650 I TestRunner: started: someTestMethod(com.example.SampleClass)".parseTestClassAndName() | ||
} | ||
|
||
it("extracts test class and method") { | ||
assertThat(args).isEqualTo("com.example.SampleClass" to "someTestMethod") | ||
} | ||
} | ||
|
||
context("parse finished log") { | ||
val args by memoized { | ||
"04-06 00:25:49.747 28632 28650 I TestRunner: finished: someTestMethod(com.example.SampleClass)".parseTestClassAndName() | ||
} | ||
|
||
it("extracts test class and method") { | ||
assertThat(args).isEqualTo("com.example.SampleClass" to "someTestMethod") | ||
} | ||
} | ||
} | ||
|
||
context("parse TestRunner log line with short prefix") { | ||
|
||
context("parse started log") { | ||
|
||
val args by memoized { | ||
"I/TestRunner( 123): started: someTestMethod(com.example.SampleClass)".parseTestClassAndName() | ||
} | ||
|
||
it("extracts test class and method") { | ||
assertThat(args).isEqualTo("com.example.SampleClass" to "someTestMethod") | ||
} | ||
} | ||
|
||
context("parse finished log") { | ||
|
||
val args by memoized { | ||
"I/TestRunner( 123): finished: someTestMethod(com.example.SampleClass)".parseTestClassAndName() | ||
} | ||
|
||
it("extracts test class and method") { | ||
assertThat(args).isEqualTo("com.example.SampleClass" to "someTestMethod") | ||
} | ||
} | ||
} | ||
|
||
context("parse non TestRunner started/finished logs") { | ||
|
||
it("does not parse empty log") { | ||
assertThat("".parseTestClassAndName()).isNull() | ||
} | ||
|
||
it("does not parse TestRunner logs without started/finished") { | ||
assertThat("I/TestRunner( 123):".parseTestClassAndName()).isNull() | ||
assertThat("04-06 00:25:49.747 28632 28650 I TestRunner:".parseTestClassAndName()).isNull() | ||
} | ||
} | ||
}) |