-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Test for InspecImporter #356
Conversation
@Test | ||
public void testImportEntries3() { | ||
|
||
InputStream inStream = InspecImportTest.class.getResourceAsStream("InspecImportTest4.txt"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try-with-resources please to ensure that the input stream is closed.
Assert.assertTrue("InspecImporter isRecognizedFormaTrue test failed", | ||
inspecImp.isRecognizedFormat(inStream)); | ||
Assert.assertFalse("InspecImporter isRecognizedFormatFalse test failed", | ||
inspecImp.isRecognizedFormat(inStream)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at #310 for handling the tests for format recognition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I editet the format recognition, so that it equals the one of #310
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I do not see this in the current PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad I understood it the wrong way. I'll fix it in the next commit.
It seems like my commits have some issues, but I don't get the problem. Can someone help me out? |
I do not think it is your commit that causes problems. For some reason the SpringerLinkFetch test fails. |
@mairdl I think, it would make sense if you squash all commits into a single commit and to a |
39632d9
to
c3e172c
Compare
eb26272
to
5adaf0d
Compare
|
||
@Before | ||
public void setUp() throws Exception { | ||
if (Globals.prefs == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If statement not necessary.
5adaf0d
to
a860ffc
Compare
5062305
to
3a0e16e
Compare
Is it ready for a merge now? |
|
5335afe
to
f9fd308
Compare
inStream.close(); | ||
assertEquals(1, entries.size()); | ||
BibEntry entry = entries.get(0); | ||
assertEquals(BibtexEntryTypes.INPROCEEDINGS.getName().toLowerCase(), entry.getType()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace this with BibtexEntryAssert.assertEquals(Arrays.ListOf(shouldBeEntry), entries) as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you mean "Arrays.ListOf(shouldBeEntry)"? Because I can't find this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simon meant the Arrays.asList
, but Collections.singletonList
also works (I think IntelliJ even suggest replacing asList with singletonList)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i try to solve it with Arrays.asList
or with Collections.singletonList
, I get an error from the assertion because I try to compare a list of BibEntry with a BibEntry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But entries
is a list, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entries
is a BibEntry
as suggested in earlier comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reference the comment. You can get the deep link to a comment using the time given at a commit. While scrolling through here, I don't see that comment directly. Please help the reader by clear references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Braunch: I don't know, what you did, but all commits seem to be lost. Please use |
@koppor I think Chris(braunch) squashed all commits into 1 |
3e4c73c
to
5d6980c
Compare
I hope my last commit fixed that. Otherwise I am doing something wrong with git. |
Tests are failing, please investigate. |
Now the tests are working |
49ff62c
to
5846469
Compare
@tobiasdiez @koppor @simonharrer Are you happy enough with it now? We can squash the commits via the merge button. |
|
||
try (InputStream inStream = new ByteArrayInputStream(testInput.getBytes())) { | ||
List<BibEntry> entries = inspecImp.importEntries(inStream, new OutputPrinterToNull()); | ||
assertEquals(1, entries.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use BibtexEntryAssert.assertEquals(Collections.singletonList(shouldbeEntry), entries);
Interesting that the code coverage decreases according to codecov by 0.85% in a PR which aims to increase test coverage. Very strange. |
I think it is because the code in this PR is based on an older code base, so fewer tests included and the comparison is against the (at the time of the push) current master. Push again and it would decrease > 2%... |
Completed code coverage and discovered a bug in BibtexEntryType (BibtetEntryType.getType() ALL_TYPES.get() returns null)