Skip to content

Commit

Permalink
Fix Detekt warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yevhenii-nadtochii committed Dec 23, 2024
1 parent 065dbae commit 7da8ead
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,10 @@ abstract class ValidationOfConstraintTest {
}
}

/**
* Asserts that calling the `build()` method of the passed builder throws `ValidationException`.
*/
private fun assertDoesNotBuild(builder: Message.Builder) {
assertThrows<ValidationException> {
builder.build()
}
}

/**
* Asserts that the creation of the message fails when the [setup] function is invoked.
*
* The most common use case is when the message is created via a Kotlin DSL block.
*
* @see assertDoesNotBuild
*/
protected fun assertDoesNotBuild(setup: () -> Message) {
assertThrows<ValidationException> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ private const val DEFAULT_MESSAGE_FORMAT =
"the value `\${field.value}` and cannot be reassigned to `\${field.proposed_value}`."

private fun customMessageFormat(fieldNumber: Int) =
"Field_$fieldNumber: `\${field.value}`, `\${field.name}`, `\${field.proposed_value}`, `\${field.type}`."
"Field_$fieldNumber: " +
"`\${field.value}`, `\${field.name}`, `\${field.proposed_value}`, `\${field.type}`."
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import io.kotest.matchers.string.shouldContain
import io.spine.type.toJson
import io.spine.validate.ConstraintViolation
import io.spine.validate.ValidationException
import io.spine.validate.text.format
import org.junit.jupiter.api.Assertions.assertDoesNotThrow
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.Assertions.fail
Expand Down Expand Up @@ -90,7 +89,7 @@ fun assertViolation(
.contains(field)

val violation = violations.atField(field)
violation.message.format() shouldContain errorMessagePart
violation.message.withPlaceholders shouldContain errorMessagePart
}

/**
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.protodata</groupId>
<artifactId>protodata-backend</artifactId>
<version>0.80.3</version>
<version>0.80.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.protodata</groupId>
<artifactId>protodata-java</artifactId>
<version>0.80.3</version>
<version>0.80.4</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -134,13 +134,13 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.protodata</groupId>
<artifactId>protodata-api</artifactId>
<version>0.80.3</version>
<version>0.80.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.spine.protodata</groupId>
<artifactId>protodata-testlib</artifactId>
<version>0.80.3</version>
<version>0.80.4</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -239,12 +239,12 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.protodata</groupId>
<artifactId>protodata-fat-cli</artifactId>
<version>0.80.3</version>
<version>0.80.4</version>
</dependency>
<dependency>
<groupId>io.spine.protodata</groupId>
<artifactId>protodata-protoc</artifactId>
<version>0.80.3</version>
<version>0.80.4</version>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
Expand Down

0 comments on commit 7da8ead

Please sign in to comment.