@@ -52,7 +52,7 @@ class JournalAbbreviationRepositoryTest {
52
52
private JournalAbbreviationRepository createTestRepository () {
53
53
JournalAbbreviationRepository testRepo = new JournalAbbreviationRepository ();
54
54
55
- testRepo .addCustomAbbreviations (List .of (
55
+ testRepo .addCustomAbbreviations (Set .of (
56
56
AMERICAN_JOURNAL ,
57
57
ACS_MATERIALS ,
58
58
ANTIOXIDANTS ,
@@ -409,7 +409,7 @@ void dotlessForPhysRevB() {
409
409
@ ParameterizedTest
410
410
@ MethodSource ("provideAbbreviationTestCases" )
411
411
void fuzzyMatch (List <Abbreviation > abbreviationList , String input , String expectedAbbreviation , String expectedDotless , String expectedShortest , String ambiguousInput ) {
412
- repository .addCustomAbbreviations (abbreviationList );
412
+ repository .addCustomAbbreviations (Set . copyOf ( abbreviationList ) );
413
413
414
414
assertEquals (expectedAbbreviation , repository .getDefaultAbbreviation (input ).orElse ("WRONG" ));
415
415
@@ -423,7 +423,7 @@ void fuzzyMatch(List<Abbreviation> abbreviationList, String input, String expect
423
423
static Stream <Arguments > provideAbbreviationTestCases () {
424
424
return Stream .of (
425
425
Arguments .of (
426
- List .of (
426
+ Set .of (
427
427
new Abbreviation ("Journal of Physics A" , "J. Phys. A" , "JPA" ),
428
428
new Abbreviation ("Journal of Physics B" , "J. Phys. B" , "JPB" ),
429
429
new Abbreviation ("Journal of Physics C" , "J. Phys. C" , "JPC" )
@@ -435,7 +435,7 @@ static Stream<Arguments> provideAbbreviationTestCases() {
435
435
"Journal of Physics"
436
436
),
437
437
Arguments .of (
438
- List .of (
438
+ Set .of (
439
439
new Abbreviation ("中国物理学报" , "物理学报" , "ZWP" ),
440
440
new Abbreviation ("中国物理学理" , "物理学报报" , "ZWP" ),
441
441
new Abbreviation ("中国科学: 物理学" , "中科物理" , "ZKP" )
@@ -447,7 +447,7 @@ static Stream<Arguments> provideAbbreviationTestCases() {
447
447
"中国物理学"
448
448
),
449
449
Arguments .of (
450
- List .of (
450
+ Set .of (
451
451
new Abbreviation ("Zeitschrift für Chem" , "Z. Phys. Chem." , "ZPC" ),
452
452
new Abbreviation ("Zeitschrift für Chys" , "Z. Angew. Chem." , "ZAC" )
453
453
),
@@ -464,7 +464,7 @@ static Stream<Arguments> provideAbbreviationTestCases() {
464
464
void addCustomAbbreviationsWithEnabledState () {
465
465
String sourceKey = "test-source" ;
466
466
467
- repository .addCustomAbbreviations (List .of (
467
+ repository .addCustomAbbreviations (Set .of (
468
468
new Abbreviation ("Journal One" , "J. One" ),
469
469
new Abbreviation ("Journal Two" , "J. Two" )
470
470
), sourceKey , true );
@@ -479,7 +479,7 @@ void addCustomAbbreviationsWithEnabledState() {
479
479
void disablingSourcePreventsAccessToAbbreviations () {
480
480
String sourceKey = "test-source" ;
481
481
482
- repository .addCustomAbbreviations (List .of (
482
+ repository .addCustomAbbreviations (Set .of (
483
483
new Abbreviation ("Unique Journal" , "U. J." )
484
484
), sourceKey , true );
485
485
@@ -497,7 +497,7 @@ void disablingSourcePreventsAccessToAbbreviations() {
497
497
void reenablingSourceRestoresAccessToAbbreviations () {
498
498
String sourceKey = "test-source" ;
499
499
500
- repository .addCustomAbbreviations (List .of (
500
+ repository .addCustomAbbreviations (Set .of (
501
501
new Abbreviation ("Disabled Journal" , "D. J." )
502
502
), sourceKey , true );
503
503
@@ -545,11 +545,11 @@ void multipleSourcesCanBeToggled() {
545
545
String sourceKey1 = "source-1-special" ;
546
546
String sourceKey2 = "source-2-special" ;
547
547
548
- testRepo .addCustomAbbreviations (List .of (
548
+ testRepo .addCustomAbbreviations (Set .of (
549
549
new Abbreviation ("Unique Journal Source One XYZ" , "UniqueJS1" )
550
550
), sourceKey1 , true );
551
551
552
- testRepo .addCustomAbbreviations (List .of (
552
+ testRepo .addCustomAbbreviations (Set .of (
553
553
new Abbreviation ("Unique Journal Source Two ABC" , "UniqueJS2" )
554
554
), sourceKey2 , true );
555
555
@@ -624,15 +624,15 @@ void getAllAbbreviationsWithSourcesReturnsCorrectSources() {
624
624
625
625
testRepo .getCustomAbbreviations ().clear ();
626
626
627
- testRepo .addCustomAbbreviations (List .of (
627
+ testRepo .addCustomAbbreviations (Set .of (
628
628
AMERICAN_JOURNAL ,
629
629
ACS_MATERIALS ,
630
630
ANTIOXIDANTS ,
631
631
PHYSICAL_REVIEW
632
632
), JournalAbbreviationRepository .BUILTIN_LIST_ID , true );
633
633
634
634
String customSource = "test-custom" ;
635
- testRepo .addCustomAbbreviations (List .of (
635
+ testRepo .addCustomAbbreviations (Set .of (
636
636
new Abbreviation ("Custom Journal" , "Cust. J." )
637
637
), customSource , true );
638
638
@@ -657,7 +657,7 @@ void getAllAbbreviationsWithSourcesReturnsCorrectSources() {
657
657
assertTrue (customAbbr .isPresent (), "Should find custom abbreviation with source" );
658
658
assertEquals ("Custom Journal" , customAbbr .get ().getAbbreviation ().getName ());
659
659
660
- for (Abbreviation abbr : List .of (AMERICAN_JOURNAL , ACS_MATERIALS , ANTIOXIDANTS , PHYSICAL_REVIEW )) {
660
+ for (Abbreviation abbr : Set .of (AMERICAN_JOURNAL , ACS_MATERIALS , ANTIOXIDANTS , PHYSICAL_REVIEW )) {
661
661
boolean found = allWithSources .stream ()
662
662
.anyMatch (aws -> JournalAbbreviationRepository .BUILTIN_LIST_ID .equals (aws .getSource ()) &&
663
663
abbr .getName ().equals (aws .getAbbreviation ().getName ()));
0 commit comments