Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate an entry from ID #8129

Merged
merged 51 commits into from
Oct 26, 2021
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
afca0ef
add prototype
Oct 7, 2021
a9f6aec
Add CompositeIdFetcherTest
Oct 8, 2021
899784e
Add CHANGELOG.md update
Oct 8, 2021
549626b
clean checkstyle warnings
Oct 8, 2021
73e0f37
update prototype
Oct 8, 2021
0863df7
clean up checkstyle in test
Oct 8, 2021
04e65ea
add binding for newEntryFromIdButton
Oct 8, 2021
195b3be
optimize
Oct 8, 2021
993edbc
delete unnecessary lines
Oct 8, 2021
6478b11
Update CHANGELOG.md
colinhex Oct 9, 2021
3a0b625
adjust button style class and focus
Oct 9, 2021
5fc8114
Merge branch 'generateEntryFromId' of github.com:colinhex/jabref-1 in…
Oct 9, 2021
8c48be0
exclude CompositeIdFetcher from WebFetchersTest
Oct 9, 2021
79da4e9
add key in en.properties
Oct 9, 2021
1ca0272
Merge branch 'main' of github.com:JabRef/jabref into generateEntryFromId
Oct 9, 2021
871e413
optimize CompositeIdFetcher.java
Oct 10, 2021
92c1bb7
Revert "optimize CompositeIdFetcher.java"
Oct 11, 2021
fd6cf56
UI tweaks
Oct 12, 2021
6aa788a
optimize imports
Oct 12, 2021
0e1570a
change log level in CompositeFetcher
Oct 12, 2021
2534f1f
optimize code
Oct 12, 2021
d10cc26
fix checkstyle warnings
Oct 12, 2021
5cf64ba
Merge branch 'main' of github.com:JabRef/jabref into generateEntryFromId
Oct 12, 2021
cea0eab
pass strings to localization.lang
Oct 17, 2021
d89a84b
optimize code
Oct 17, 2021
b00a749
add IacrEprint identifier
Oct 17, 2021
b58fbdb
add IacrEprint identifier and tests
Oct 17, 2021
97344b0
Merge branch 'main' of github.com:JabRef/jabref into generateEntryFromId
Oct 17, 2021
1220f2f
adjust CompositeIdFetcher
Oct 17, 2021
450eb3f
optimize CompositeIdFetcher
Oct 17, 2021
c669ceb
delete unnecessary lines
Oct 17, 2021
c168695
separately handle fetcherexceptions in CompositeIdFetcher
Oct 17, 2021
3d6db7b
Revert "separately handle fetcherexceptions in CompositeIdFetcher"
Oct 17, 2021
832c185
optimize imports
Oct 17, 2021
311aa63
delete empty line
Oct 17, 2021
2b3070f
fix label not appearing
Oct 17, 2021
836e347
clear checkstyle errors
Oct 17, 2021
c563ff0
convert to parametrized test
Oct 25, 2021
0a2a828
optimize parametrized tests
Oct 25, 2021
f8a0ec3
add logger to CompositeIdFetcher
Oct 25, 2021
bcbb143
minor tweaks
Oct 25, 2021
5a90ec7
change status messages
Oct 25, 2021
2cd6332
add tooltip
Oct 25, 2021
950ad1f
close PopOver in success case
Oct 25, 2021
cbb702c
handle doi first
Oct 26, 2021
87ddfac
change status messages, include exceptions
Oct 26, 2021
8259ffc
delete unused logger
Oct 26, 2021
4aa20bc
catch fetcher exception in test
Oct 26, 2021
0be09f0
Revert "catch fetcher exception in test"
Oct 26, 2021
14d5885
add throws to test methods
Oct 26, 2021
3e705f6
remove obsolete localization key
Oct 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 36 additions & 26 deletions src/test/java/org/jabref/model/entry/identifier/IacrEprintTest.java
Original file line number Diff line number Diff line change
@@ -1,45 +1,55 @@
package org.jabref.model.entry.identifier;

import java.util.stream.Stream;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import static org.junit.jupiter.api.Assertions.assertEquals;
colinhex marked this conversation as resolved.
Show resolved Hide resolved
import static org.junit.jupiter.api.Assertions.assertThrows;

public class IacrEprintTest {
colinhex marked this conversation as resolved.
Show resolved Hide resolved

@Test
public void acceptPlainIacrEprint() {
assertEquals("2019/001", new IacrEprint("2019/001").getNormalized());
}

@Test
public void ignoreLeadingAndTrailingWhitespaces() {
assertEquals("2019/001", new IacrEprint(" 2019/001 ").getNormalized());
private static Stream<Arguments> provideTestData() {
return Stream.of(
Arguments.arguments(
"acceptPlainIacrEprint",
new IacrEprint("2019/001").getNormalized()
calixtus marked this conversation as resolved.
Show resolved Hide resolved
),
Arguments.arguments(
"ignoreLeadingAndTrailingWhitespaces",
new IacrEprint(" 2019/001 ").getNormalized()
),
Arguments.arguments(
"acceptFullUrlIacrEprint",
new IacrEprint("https://eprint.iacr.org/2019/001").getNormalized()
),
Arguments.arguments(
"acceptShortenedUrlIacrEprint",
new IacrEprint("https://ia.cr/2019/001").getNormalized()
),
Arguments.arguments(
"acceptDomainUrlIacrEprint",
new IacrEprint("eprint.iacr.org/2019/001").getNormalized()
),
Arguments.arguments(
"acceptShortenedDomainUrlIacrEprint",
new IacrEprint("ia.cr/2019/001").getNormalized()
)
);
}

@Test
public void rejectInvalidIacrEprint() {
assertThrows(IllegalArgumentException.class, () -> new IacrEprint("2021/12"));
}

@Test
public void acceptFullUrlIacrEprint() {
assertEquals("2019/001", new IacrEprint("https://eprint.iacr.org/2019/001").getNormalized());
}

@Test
public void acceptShortenedUrlIacrEprint() {
assertEquals("2019/001", new IacrEprint("https://ia.cr/2019/001").getNormalized());
}

@Test
public void acceptDomainUrlIacrEprint() {
assertEquals("2019/001", new IacrEprint("eprint.iacr.org/2019/001").getNormalized());
}

@Test
public void acceptShortenedDomainUrlIacrEprint() {
assertEquals("2019/001", new IacrEprint("ia.cr/2019/001").getNormalized());
@ParameterizedTest(name = "{index} {0}")
@MethodSource("provideTestData")
public void acceptCorrectIacrEprintIdentifier(String name, String arg) {
assertEquals("2019/001", arg);
}

@Test
Expand Down