forked from kitodo/kitodo-production
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kitodo#4585 from henning-gerhardt/fix_newspaper_ti…
…tle_generation Change regular expression to needed separator before date.
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 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
46 changes: 46 additions & 0 deletions
46
Kitodo/src/test/java/org/kitodo/production/migration/NewspaperProcessesMigratorTest.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,46 @@ | ||
/* | ||
* (c) Kitodo. Key to digital objects e. V. <[email protected]> | ||
* | ||
* This file is part of the Kitodo project. | ||
* | ||
* It is licensed under GNU General Public License version 3 or later. | ||
* | ||
* For the full copyright and license information, please read the | ||
* GPL3-License.txt file that was distributed with this source code. | ||
*/ | ||
|
||
package org.kitodo.production.migration; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.kitodo.data.database.beans.Batch; | ||
|
||
|
||
public class NewspaperProcessesMigratorTest { | ||
|
||
@Test | ||
public void checkNewspaperShortedTitleGeneration() { | ||
Batch testBatch = new Batch(); | ||
testBatch.setTitle("Test Batch for Newspaper Shorted Title Generation"); | ||
testBatch.setId(1234); | ||
|
||
List<String> listOfNewspaperTitles = Arrays.asList( | ||
"Aben_399196951", | ||
"DresNa_516710338", | ||
"LeipMofT_1679165712", | ||
"StaaHofM_1031939121", | ||
"Zeit_425552225" | ||
); | ||
|
||
NewspaperProcessesMigrator migrator = new NewspaperProcessesMigrator(testBatch); | ||
for (String newspaperTitle : listOfNewspaperTitles) { | ||
String dailyTitle = newspaperTitle + "-20210804"; | ||
String multipleDailyTitle = dailyTitle + "01p_01-p"; | ||
Assert.assertEquals(newspaperTitle, migrator.generateNewspaperShortTitle(dailyTitle)); | ||
Assert.assertEquals(newspaperTitle, migrator.generateNewspaperShortTitle(multipleDailyTitle)); | ||
} | ||
} | ||
} |