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

Refactor NoBibTexFieldCheckerTest to increase mutation coverage #7697

Merged
merged 3 commits into from
May 3, 2021
Merged

Refactor NoBibTexFieldCheckerTest to increase mutation coverage #7697

merged 3 commits into from
May 3, 2021

Conversation

ningxie1991
Copy link
Contributor

This pull request contributes to issue #6207, which is to add more unit tests or improve existing ones. I used Pitest to compute the mutation coverage and found that some conditions were not covered in the unit test and some conditions tested were redundant because they would not be reached. Following are the changes:

  1. Switched to using parametrized test
  2. Covers missing conditions: StandardField.DOI, StandardField.URL
  3. Redundant conditions (still remains in source code and tests): StandardField.ABSTRACT, StandardField.COMMENT (they are not included in the fields of neither BibtexEntryTypeDefinitions.ALL nor BiblatexEntryTypeDefinitions.ALL)

Before:
image

image

After:
image

image

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

…rage

1. Switched to using parametrized test
2. Covers missing conditions
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, it looks good. Some minor remark remaining

Comment on lines 26 to 39
Arguments.of(new UnknownField("fieldNameNotDefinedInThebiblatexManual"), Collections.emptyList()),

// these fields are displayed by JabRef as default
Arguments.of(StandardField.ABSTRACT, Collections.emptyList()),
Arguments.of(StandardField.COMMENT, Collections.emptyList()),
Arguments.of(StandardField.DOI, Collections.emptyList()),
Arguments.of(StandardField.URL, Collections.emptyList()),

// these fields are not recognized as biblatex only fields
Arguments.of(StandardField.ADDRESS, Collections.emptyList()),
Arguments.of(StandardField.INSTITUTION, Collections.emptyList()),
Arguments.of(StandardField.JOURNAL, Collections.emptyList()),
Arguments.of(StandardField.KEYWORDS, Collections.emptyList()),
Arguments.of(StandardField.REVIEW, Collections.emptyList())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each thing gets , Collections.emptyList() as paramter. Thus, this can be removed.

Maybe, even Stream.of(List.of(StandardField.ABSTRACT, StandardField.COMMENT, ...) can be used.

Suggested change
Arguments.of(new UnknownField("fieldNameNotDefinedInThebiblatexManual"), Collections.emptyList()),
// these fields are displayed by JabRef as default
Arguments.of(StandardField.ABSTRACT, Collections.emptyList()),
Arguments.of(StandardField.COMMENT, Collections.emptyList()),
Arguments.of(StandardField.DOI, Collections.emptyList()),
Arguments.of(StandardField.URL, Collections.emptyList()),
// these fields are not recognized as biblatex only fields
Arguments.of(StandardField.ADDRESS, Collections.emptyList()),
Arguments.of(StandardField.INSTITUTION, Collections.emptyList()),
Arguments.of(StandardField.JOURNAL, Collections.emptyList()),
Arguments.of(StandardField.KEYWORDS, Collections.emptyList()),
Arguments.of(StandardField.REVIEW, Collections.emptyList())
Arguments.of(new UnknownField("fieldNameNotDefinedInThebiblatexManual")),
// these fields are displayed by JabRef as default
Arguments.of(StandardField.ABSTRACT),
Arguments.of(StandardField.COMMENT),
Arguments.of(StandardField.DOI),
Arguments.of(StandardField.URL),
// these fields are not recognized as biblatex only fields
Arguments.of(StandardField.ADDRESS),
Arguments.of(StandardField.INSTITUTION),
Arguments.of(StandardField.JOURNAL),
Arguments.of(StandardField.KEYWORDS),
Arguments.of(StandardField.REVIEW)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is updated as suggested. :)

@koppor koppor added status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers and removed status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels May 3, 2021
@koppor koppor merged commit 45b8539 into JabRef:main May 3, 2021
Siedlerchr added a commit that referenced this pull request May 4, 2021
* upstream/main: (354 commits)
  Fix ScienceDirect fetcher (#7684)
  Refactor NoBibTexFieldCheckerTest to increase mutation coverage (#7697)
  Update Gradle from 6.8.3 to 7.0 (#7619)
  Fixes #7305: the RFC fetcher is not compatible with the draftFix for issue 7305 (#7674)
  Refactoring existing unit tests (#7693)
  cover boundary cases & add more unit tests (#7694)
  Bump classgraph from 4.8.104 to 4.8.105 (#7688)
  Bump java-diff-utils from 4.9 to 4.10 (#7692)
  Fix arXiv fetcher tests (#7686)
  Make key for ScienceDirect configurable (#7683)
  migration of timestamp (#7671)
  Fix CCSB and DOAJ (#7426)
  [Bot] Update CSL styles (#7680)
  MS Office XML: Export month name (#7677)
  linkfix (#7678)
  readd fix (#7675)
  Fix threading cleanup in performSearch (#7672)
  add missing changelog
  delete bug fix (#7580)
  Add more unit tests to three gui classes  (#7636)
  ...

# Conflicts:
#	build.gradle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants