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

Added a test case in CitationKeyGeneratorTest.java file #12194

Closed
wants to merge 43 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c407a30
Added a test case in CitationKeyGeneratorTest.java file
yoyounik Nov 16, 2024
581fb61
removed the wrong import
yoyounik Nov 16, 2024
8f66b40
Updated the pattern
yoyounik Nov 17, 2024
df2d656
Reorganized import
yoyounik Nov 17, 2024
f2559e5
Remove LaTeX commands (e.g., \mkbibquote{}) using regex.
yoyounik Nov 17, 2024
f845041
Updated with RemoveLatexCommandsFormatter in CitationKeyGenerator.java
yoyounik Nov 18, 2024
dd1f97f
Added the import for RemoveLatexCommandsFormatter
yoyounik Nov 18, 2024
3b1eda2
Added imports for removing OpenRewrite issue
yoyounik Nov 18, 2024
784f756
updated code
yoyounik Nov 18, 2024
19a80c3
updated with the import
yoyounik Nov 18, 2024
a5a37b9
updated with the import
yoyounik Nov 18, 2024
6c4e0a8
updated with the import
yoyounik Nov 18, 2024
beacb03
Removed the comment
yoyounik Nov 19, 2024
0368236
Updated with imports
yoyounik Nov 19, 2024
b70ad43
Updated with imports
yoyounik Nov 19, 2024
8e4a7e1
Updated with imports
yoyounik Nov 19, 2024
6fff450
Updated with imports
yoyounik Nov 19, 2024
85befed
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
07064db
Instantiating the formatter as object variable
yoyounik Nov 20, 2024
c53891f
Instantiating the formatter as object variable
yoyounik Nov 20, 2024
4868e0d
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
912e1b2
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
74dc490
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
f1c8535
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
97f968b
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
4899a18
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
28f9f2f
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 20, 2024
ff7925f
Updated with changes in LatexCleanupFormatter.java
yoyounik Nov 21, 2024
d41a9d7
Updated with changes in LatexCleanupFormatter.java
yoyounik Nov 21, 2024
3c00c29
Updated cleanKey method.
yoyounik Nov 22, 2024
8d9845b
Updated cleanKey method.
yoyounik Nov 22, 2024
83c5841
Updated cleanKey method.
yoyounik Nov 22, 2024
89b1106
Updated cleanKey method.
yoyounik Nov 22, 2024
d95e7e1
Merge remote-tracking branch 'origin/fix/strip-latex-from-filename' i…
yoyounik Nov 22, 2024
83e3c06
Updated cleanKey method.
yoyounik Nov 22, 2024
6ecdb03
Updated cleanKey method.
yoyounik Nov 22, 2024
9cc84a1
Updated cleanKey method.
yoyounik Nov 22, 2024
36a42f3
Updated cleanKey method.
yoyounik Nov 22, 2024
25ce9a9
Updated cleanKey method.
yoyounik Nov 22, 2024
0d2bea3
Updated cleanKey method.
yoyounik Nov 27, 2024
ab938b0
Updated
yoyounik Nov 27, 2024
89d2f05
Updated
yoyounik Nov 27, 2024
3e69e0c
Updated
yoyounik Nov 28, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.Answers;

import static org.jabref.logic.citationkeypattern.CitationKeyGenerator.DEFAULT_UNWANTED_CHARACTERS;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand Down Expand Up @@ -131,6 +130,15 @@ void crossrefAndInAuthorNames() {
database), DEFAULT_UNWANTED_CHARACTERS));
}

@Test
void testLatexCommandsAreStrippedFromCitationKey() throws ParseException {
BibEntry entry = new BibEntry()
.withField(StandardField.TITLE, "Building \\mkbibquote{Community}");
String pattern = "[title]";
Copy link
Member

Choose a reason for hiding this comment

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

Did you read the issue? Did your LLM fail? Which tool.did you use?

[bibtexkey] - [fulltitle]

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I read the issue and understood the problem about LaTeX commands not being stripped correctly from fields used in filename generation.
I used an AI assistant to refine my understanding of the issue and help structure the PR. However, the final implementation and test case were written based on my own understanding. If there is any discrepancy, I take full responsibility for the work.
I used ChatGPT as a supporting tool to draft and clarify ideas.

Copy link
Member

Choose a reason for hiding this comment

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

I quoted the most important part of the issue above. Please adapt the test case accordingly.

Copy link
Author

Choose a reason for hiding this comment

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

Hey @koppor
i guess i need to read the documentation and little more about this to work on this currently.

Copy link
Member

Choose a reason for hiding this comment

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

Hey @koppor
i guess i need to read the documentation and little more about this to work on this currently.

You need to change a single line in your test case. Instead of [title] use the pattern reported by the user

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @koppor , have updated the pattern reported by the user by [bibtexkey] - [fulltitle]

Copy link
Author

Choose a reason for hiding this comment

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

But i guess there is more to the issue

Copy link
Author

Choose a reason for hiding this comment

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

The import order does not match so i guess i will check it once, and some more unit test issue which i am going throw again

Copy link
Author

Choose a reason for hiding this comment

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

Hey @koppor i have made some changes accordingly, but still the OpenRewrite and UnitTest error is remaining, i will be checking it once again by tomorrow. If you have any hint please provide it , Thanks :)

Copy link
Member

Choose a reason for hiding this comment

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

grafik Click on details to see the exact cause of the failure

String generatedKey = generateKey(entry, pattern);
assertEquals("BuildingCommunity", generatedKey);
}

@Test
void andAuthorNames() throws ParseException {
String bibtexString = "@ARTICLE{whatevery, author={Mari D. Herland and Mona-Iren Hauge and Ingeborg M. Helgeland}}";
Expand Down
Loading