refactor(api): minor QOL updates, code modernization (#1802)
* refactor(api): minor QOL updates, code modernization Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * refactor(oidc): replace regex literals with compiled patterns for improved performance Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> * refactor(shelf): remove redundant icon type initialization method Signed-off-by: Balázs Szücs <bszucs1209@gmail.com> --------- Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ class KoboEntitlementServiceTest {
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.getDownloadUrls().size());
|
||||
assertEquals(KoboBookFormat.EPUB3.toString(), result.getDownloadUrls().get(0).getFormat());
|
||||
assertEquals(KoboBookFormat.EPUB3.toString(), result.getDownloadUrls().getFirst().getFormat());
|
||||
}
|
||||
|
||||
private BookEntity createCbxBookEntity(Long id) {
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ class FileMoveServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void moveSingleFile_whenLibraryMonitored_reRegistersLibraryPaths() throws Exception {
|
||||
void moveSingleFile_whenLibraryMonitored_reRegistersLibraryPaths() {
|
||||
when(monitoringRegistrationService.isLibraryMonitored(42L)).thenReturn(true);
|
||||
|
||||
FileMoveResult result = fileMoveService.moveSingleFile(bookEntity);
|
||||
@@ -96,7 +96,7 @@ class FileMoveServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void moveSingleFile_whenLibraryNotMonitored_skipsMonitoringCalls() throws Exception {
|
||||
void moveSingleFile_whenLibraryNotMonitored_skipsMonitoringCalls() {
|
||||
when(monitoringRegistrationService.isLibraryMonitored(42L)).thenReturn(false);
|
||||
|
||||
FileMoveResult result = fileMoveService.moveSingleFile(bookEntity);
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.adityachandel.booklore.util;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class Md5UtilTest {
|
||||
|
||||
private static final Pattern PATTERN = Pattern.compile("[a-f0-9]{32}");
|
||||
|
||||
@Test
|
||||
void testMd5Hex_emptyString() {
|
||||
String result = Md5Util.md5Hex("");
|
||||
@@ -75,6 +80,6 @@ class Md5UtilTest {
|
||||
void testMd5Hex_length() {
|
||||
String result = Md5Util.md5Hex("any input");
|
||||
assertEquals(32, result.length()); // MD5 always produces 32 character hex string
|
||||
assertTrue(result.matches("[a-f0-9]{32}")); // Only lowercase hex characters
|
||||
assertTrue(PATTERN.matcher(result).matches()); // Only lowercase hex characters
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user