-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH-458 Cover FailureFacade with unit test and fix joinToString method…
…s usage
- Loading branch information
Showing
2 changed files
with
32 additions
and
27 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
25 changes: 25 additions & 0 deletions
25
reposilite-backend/src/test/kotlin/com/reposilite/failure/FailureFacadeTest.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,25 @@ | ||
package com.reposilite.failure | ||
|
||
import net.dzikoysk.dynamiclogger.backend.InMemoryLogger | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class FailureFacadeTest { | ||
|
||
private val failureFacade = FailureFacade(InMemoryLogger()) | ||
|
||
@Test | ||
fun `should store failure`() { | ||
// given: an exception with a message | ||
val message = "Unlucky" | ||
val exception = RuntimeException(message) | ||
|
||
// when: an error has been registered in failure facade | ||
failureFacade.throwException("PATH /com/reposilite", exception) | ||
|
||
// then: service properly registered thrown exception | ||
assertTrue(failureFacade.hasFailures()) | ||
assertTrue(failureFacade.getFailures().iterator().next().contains(message)) | ||
} | ||
|
||
} |