mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-21 20:21:27 +00:00
optimized tests and some code docu
This commit is contained in:
@@ -152,6 +152,14 @@ public class ErrorController implements FxController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an ErrorDiscussion object is a partial match based on the presence of the error code's method code in its title.
|
||||
*
|
||||
* @param errorDiscussion The ErrorDiscussion object to be checked.
|
||||
* @return A boolean value indicating if the ErrorDiscussion object is a partial match:
|
||||
* - true if the object's title contains the error code's method code,
|
||||
* - false otherwise.
|
||||
*/
|
||||
public boolean isPartialMatchFilter(ErrorDiscussion errorDiscussion) {
|
||||
return errorDiscussion.title.contains(" " + errorCode.methodCode());
|
||||
}
|
||||
|
||||
@@ -55,23 +55,13 @@ class ErrorControllerTest {
|
||||
@CsvSource(textBlock = """
|
||||
10, 5, -1
|
||||
8, 15, 1
|
||||
10, 10, 0
|
||||
""")
|
||||
public void testCompareUpvoteCount1(int leftUpvoteCount, int rightUpvoteCount, int expectedResult) {
|
||||
public void testCompareUpvoteCount(int leftUpvoteCount, int rightUpvoteCount, int expectedResult) {
|
||||
var left = createErrorDiscussion("", leftUpvoteCount, null);
|
||||
var right = createErrorDiscussion("", rightUpvoteCount, null);
|
||||
int result = errorController.compareUpvoteCount(left, right);
|
||||
Assertions.assertTrue(result*expectedResult>0);
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource(textBlock = """
|
||||
10, 10
|
||||
""")
|
||||
public void testCompareUpvoteCount2(int leftUpvoteCount, int rightUpvoteCount) {
|
||||
var left = createErrorDiscussion("", leftUpvoteCount, null);
|
||||
var right = createErrorDiscussion("", rightUpvoteCount, null);
|
||||
int result = errorController.compareUpvoteCount(left, right);
|
||||
Assertions.assertEquals(0,result);
|
||||
Assertions.assertEquals(expectedResult,Integer.signum(result));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
|
||||
Reference in New Issue
Block a user