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

Code Coverage Enhancement for 'javaparser-core/src/main/java/com/github/javaparser/ast/body' package #4181

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

YinyinChencr7
Copy link

Fixes #820 .

This is a cleaner version of my previous PR aimed at improving the code coverage for the 'body' package.

Key Highlights

  • Introduced comprehensive unit tests, especially focusing on classes such as 'AnnotationMemberDeclaration' within the 'body' package.
  • Enhanced coverage for functionalities like annotation methods, type casting, and method declaration.
  • Addressed edge cases to ensure the robustness of the code.

Code Coverage Progress

  • Initial code coverage for 'body' package: 54.57%
  • Code coverage after these changes: 72.53%

Notes from Previous PRs

I am aware of the concerns raised in the past regarding changes made in the pom.xml files. I noticed that these files' changes are due to my old commits. To address this, I made a new branch and ensured this PR strictly focuses on improving code coverage without any unrelated changes.

I value the feedback from the maintainers and apologise for any inconvenience caused by my previous submissions. I appreciate your patience and guidance throughout this process.

@@ -0,0 +1,127 @@
/*
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
Copy link
Collaborator

Choose a reason for hiding this comment

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

For the creation of new classes this copywright is not useful.

@Test
void testReplaceThrownException() {
CompactConstructorDeclaration decl = new CompactConstructorDeclaration();
ReferenceType oldRt = new ReferenceType() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

To simulate behaviors why don't you use Mockito or at least share this code.


@Test
void testRemoveThrownException() {
CompactConstructorDeclaration decl = new CompactConstructorDeclaration();
Copy link
Collaborator

Choose a reason for hiding this comment

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

To simulate behaviors why don't you use Mockito or at least share this code.

class CallableDeclarationTest {

// A concrete subclass of CallableDeclaration for testing
private static class ConcreteCallableDeclaration extends CallableDeclaration<ConcreteCallableDeclaration> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why don't you use Mockito here?

class BodyDeclarationTest {

// A concrete subclass of BodyDeclaration for testing
private static class ConcreteBodyDeclaration extends BodyDeclaration<ConcreteBodyDeclaration> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why don't you use Mockito

@@ -165,5 +165,4 @@ public void testTypeCastingMethods() {
assertEquals(Optional.empty(), decl.toRecordDeclaration());
assertEquals(Optional.empty(), decl.toCompactConstructorDeclaration());
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you making changes without added value?

@@ -154,15 +154,13 @@ public ResolvedType resolve() {
assertTrue(removed);
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you making changes without added value?

@@ -139,6 +139,4 @@ public void testTypeCastingMethods() {

assertTrue(enumConstant.toEnumConstantDeclaration().isPresent());
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you making changes without added value?

@@ -122,6 +122,4 @@ public void testTypeCastingMethods() {

assertTrue(enumDeclaration.toEnumDeclaration().isPresent());
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you making changes without added value?

@YinyinChencr7
Copy link
Author

Thank you for the feedback. I understand the changes that need to be made. However, I have some final exams coming up over the next couple of weeks. Would it be okay if I made these changes after my exams? Thank you for your understanding.

@jlerbsc
Copy link
Collaborator

jlerbsc commented Nov 1, 2023

No problem, I'll wait to validate this PR. Good luck for the exams.

@YinyinChencr7
Copy link
Author

Thank you so much for your understanding and patience 😀

@jlerbsc
Copy link
Collaborator

jlerbsc commented Mar 12, 2024

Do you have time to update this PR or should I close it?

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.

Increase code coverage
2 participants