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

Migrating Tests From JUnit 3 (GitAPITesCase) to JUnit 4 (GitAPITest) #678

Merged
merged 5 commits into from
Feb 28, 2021

Conversation

GAyan17
Copy link
Contributor

@GAyan17 GAyan17 commented Feb 27, 2021

JENKINS-60940 - Migrating Tests From JUnit 3 (GitAPITesCase) to JUnit 4 (GitAPITest)

Migrated few of the Tests which are for only CLI Git.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have referenced the Jira issue related to my changes in one or more commit messages
  • I have added tests that verify my changes
  • Unit tests pass locally with my changes
  • I have added documentation as necessary
  • No Javadoc warnings were introduced with my changes
  • No spotbugs warnings were introduced with my changes
  • I have interactively tested my changes

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

  • Tests (non-breaking change which updates dependencies or improves infrastructure)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Further comments

If this is a relatively large or complex change, start the discussion by explaining why you chose the solution you did and what alternatives you considered.

@MarkEWaite MarkEWaite added the test Automated test addition or improvement label Feb 27, 2021
Copy link
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

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

Approved with two optional comments. Will merge in 24 hours unless you tell me you need more time based on the optional comments.

Comment on lines 118 to 119
// workspace = new WorkspaceWithRepo(repoRoot, gitImplName, listener);
// workspace = new WorkspaceWithRepo(temporaryDirectoryAllocator.allocate(), gitImplName, listener);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since repoRoot has been removed above, it would be good to remove it here as well.

Suggested change
// workspace = new WorkspaceWithRepo(repoRoot, gitImplName, listener);
// workspace = new WorkspaceWithRepo(temporaryDirectoryAllocator.allocate(), gitImplName, listener);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're actually I missed out this one when removing. Will complete it, but need some time.

assertFixSubmoduleUrlsThrows();
}

public void assertFixSubmoduleUrlsThrows() throws InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're willing, I'm curious if this could be converted to use the JUnit 4 ExpectedException rather than try / catch / fail. I'm also OK if you decide that it is not worth the effort to make that transition at this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try for it. And let you know. I need to look into documentation of ExpectedException of JUnit 4.

@GAyan17
Copy link
Contributor Author

GAyan17 commented Feb 28, 2021

@MarkEWaite Should I also change other Exception assertions to ExpectedException ?

@MarkEWaite
Copy link
Contributor

@GAyan17 if you can make that conversion, I think it is a very good change.

@GAyan17
Copy link
Contributor Author

GAyan17 commented Feb 28, 2021

Okay, with the remaining tests I'll also try to eventually convert those exception assertions to ExpectedException

@MarkEWaite MarkEWaite merged commit cf232ac into jenkinsci:master Feb 28, 2021
@MarkEWaite
Copy link
Contributor

Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Automated test addition or improvement
Projects
None yet
2 participants