Skip to content

Commit

Permalink
Fixed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Jul 16, 2016
1 parent 14a0bdc commit fe118ec
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public CleanupPresetPanel(BibDatabaseContext databaseContext, CleanupPreset clea
private void init() {
cleanUpDOI = new JCheckBox(
Localization.lang("Move DOIs from note and URL field to DOI field and remove http prefix"));
cleanUpISSN = new JCheckBox(Localization.lang("Add possibly missing dash to ISSN"));
cleanUpISSN = new JCheckBox(Localization.lang("Reformat ISSN"));
if (databaseContext.getMetaData().getDefaultFileDirectory().isPresent()) {
cleanUpMovePDF = new JCheckBox(Localization.lang("Move linked files to default file directory %0",
databaseContext.getMetaData().getDefaultFileDirectory().get()));
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_da.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1707,4 +1707,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2425,4 +2425,5 @@ Custom=



Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2273,4 +2273,4 @@ JabRef_is_up-to-date.=JabRef_is_up-to-date.
Latest_version=Latest_version
Online_help_forum=Online_help_forum
Custom=Custom
Add_possibly_missing_dash_to_ISSN=Add_possibly_missing_dash_to_ISSN
Reformat_ISSN=Reformat_ISSN
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1609,4 +1609,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_fa.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2395,4 +2395,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1653,4 +1653,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_in.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1628,4 +1628,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1728,4 +1728,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2373,4 +2373,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2404,4 +2404,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_no.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2800,4 +2800,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1622,4 +1622,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2372,4 +2372,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1565,4 +1565,5 @@ Custom=Egna



Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1641,4 +1641,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2396,4 +2396,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
3 changes: 2 additions & 1 deletion src/main/resources/l10n/JabRef_zh.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1635,4 +1635,5 @@ Custom=

Converts_HTML_code_to_Unicode.=

Add_possibly_missing_dash_to_ISSN=

Reformat_ISSN=
32 changes: 0 additions & 32 deletions src/test/java/net/sf/jabref/logic/cleanup/CleanupWorkerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;

import net.sf.jabref.BibDatabaseContext;
import net.sf.jabref.Globals;
import net.sf.jabref.JabRefPreferences;
Expand Down Expand Up @@ -167,36 +165,6 @@ public void cleanupDoiReturnsChangeWhenDoiInURLField() {
Assert.assertEquals(changeList, changes);
}

@Test
public void cleanupISSNReturnsCorrectISSN() {
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN);
BibEntry entry = new BibEntry();
entry.setField("issn", "0123-4567");

worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("0123-4567"), entry.getFieldOptional("issn"));
}

@Test
public void cleanupISSNAddsMissingDash() {
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN);
BibEntry entry = new BibEntry();
entry.setField("issn", "01234567");

worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("0123-4567"), entry.getFieldOptional("issn"));
}

@Test
public void cleanupISSNJunkStaysJunk() {
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN);
BibEntry entry = new BibEntry();
entry.setField("issn", "Banana");

worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("Banana"), entry.getFieldOptional("issn"));
}

@Test
public void cleanupMonthChangesNumberToBibtex() {
CleanupPreset preset = new CleanupPreset(new FieldFormatterCleanups(true,
Expand Down
55 changes: 55 additions & 0 deletions src/test/java/net/sf/jabref/logic/cleanup/ISSNCleanupTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package net.sf.jabref.logic.cleanup;

import java.util.Optional;

import net.sf.jabref.BibDatabaseContext;
import net.sf.jabref.logic.journals.JournalAbbreviationLoader;
import net.sf.jabref.model.entry.BibEntry;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import static org.mockito.Mockito.mock;

public class ISSNCleanupTest {

private CleanupWorker worker;


@Before
public void setUp() {
worker = new CleanupWorker(mock(BibDatabaseContext.class), mock(JournalAbbreviationLoader.class));
}

@Test
public void cleanupISSNReturnsCorrectISSN() {
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN);
BibEntry entry = new BibEntry();
entry.setField("issn", "0123-4567");

worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("0123-4567"), entry.getFieldOptional("issn"));
}

@Test
public void cleanupISSNAddsMissingDash() {
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN);
BibEntry entry = new BibEntry();
entry.setField("issn", "01234567");

worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("0123-4567"), entry.getFieldOptional("issn"));
}

@Test
public void cleanupISSNJunkStaysJunk() {
CleanupPreset preset = new CleanupPreset(CleanupPreset.CleanupStep.CLEAN_UP_ISSN);
BibEntry entry = new BibEntry();
entry.setField("issn", "Banana");

worker.cleanup(preset, entry);
Assert.assertEquals(Optional.of("Banana"), entry.getFieldOptional("issn"));
}

}

0 comments on commit fe118ec

Please sign in to comment.