Fix metadata match weights failing to deserialize when fields are null (#2886)
This commit is contained in:
+13
-3
@@ -33,12 +33,12 @@ class MetadataMatchServiceTest {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
weights = MetadataMatchWeights.builder()
|
||||
weights = zeroWeights()
|
||||
.title(10)
|
||||
.subtitle(5)
|
||||
.description(5)
|
||||
.authors(10)
|
||||
.build(); // other fields default to 0
|
||||
.build();
|
||||
|
||||
AppSettings appSettings = AppSettings.builder()
|
||||
.metadataMatchWeights(weights)
|
||||
@@ -80,7 +80,7 @@ class MetadataMatchServiceTest {
|
||||
|
||||
@Test
|
||||
void calculateMatchScore_shouldScoreLockedNullSeriesNumber() {
|
||||
weights = MetadataMatchWeights.builder()
|
||||
weights = zeroWeights()
|
||||
.title(10)
|
||||
.seriesNumber(5)
|
||||
.build();
|
||||
@@ -106,4 +106,14 @@ class MetadataMatchServiceTest {
|
||||
|
||||
assertEquals(100.0f, score, 0.01f);
|
||||
}
|
||||
|
||||
private MetadataMatchWeights.MetadataMatchWeightsBuilder zeroWeights() {
|
||||
return MetadataMatchWeights.builder()
|
||||
.title(0).subtitle(0).description(0).authors(0).publisher(0)
|
||||
.publishedDate(0).seriesName(0).seriesNumber(0).seriesTotal(0)
|
||||
.isbn13(0).isbn10(0).language(0).pageCount(0).categories(0)
|
||||
.amazonRating(0).amazonReviewCount(0).goodreadsRating(0)
|
||||
.goodreadsReviewCount(0).hardcoverRating(0).hardcoverReviewCount(0)
|
||||
.doubanRating(0).doubanReviewCount(0).ranobedbRating(0).coverImage(0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user