-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
scavchik
committed
Sep 11, 2023
1 parent
3a84c9c
commit 386e9bf
Showing
2 changed files
with
75 additions
and
7 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
57 changes: 57 additions & 0 deletions
57
src/test/java/com/github/engatec/vdl/service/newversion/NewVersionPredicateTest.java
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,57 @@ | ||
package com.github.engatec.vdl.service.newversion; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class NewVersionPredicateTest { | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"1.0, 0.9", | ||
"1.1, 1.0", | ||
"1.1.3, 1.1.1", | ||
"1.1.3.1, 1.1.3", | ||
"1.1.10, 1.1.9", | ||
"1.5.3, 1.4.9", | ||
"1.10.1, 1.9.29", | ||
"1.10.1, 1.10.0", | ||
"12, 1.3.5" | ||
}) | ||
void givenNewAndCurrentVersions_whenNewVersionIsHigher_thenReturnTrue(String newVersion, String currentVersion) { | ||
boolean result = new NewVersionPredicate().test(newVersion, currentVersion); | ||
assertThat(result).isTrue(); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"0.9, 0.9", | ||
"1.0, 1.0", | ||
"1.1.3, 1.1.3", | ||
"1.1.3.1, 1.1.3.1", | ||
"1.10, 1.10", | ||
"12, 12" | ||
}) | ||
void givenNewAndCurrentVersions_whenVersionsEqual_thenReturnFalse(String newVersion, String currentVersion) { | ||
boolean result = new NewVersionPredicate().test(newVersion, currentVersion); | ||
assertThat(result).isFalse(); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"0.9, 1.0", | ||
"1.0, 1.1", | ||
"1.1.1, 1.1.3", | ||
"1.1.3, 1.1.3.1", | ||
"1.1.9, 1.1.10", | ||
"1.4.9, 1.5.3", | ||
"1.9.29, 1.10.1", | ||
"1.10.0, 1.10.1", | ||
"1.3.5, 12" | ||
}) | ||
void givenNewAndCurrentVersions_whenCurrentVersionIsHigher_thenReturnFalse(String newVersion, String currentVersion) { | ||
boolean result = new NewVersionPredicate().test(newVersion, currentVersion); | ||
assertThat(result).isFalse(); | ||
} | ||
} |