[JIRA] (JENKINS-56718) Add unit tests for BlameFactory

2 views
Skip to first unread message

ullrich.hafner@gmail.com (JIRA)

unread,
Mar 23, 2019, 7:33:01 AM3/23/19
to jenkinsc...@googlegroups.com
Ulli Hafner created an issue
 
Jenkins / Improvement JENKINS-56718
Add unit tests for BlameFactory
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: warnings-ng-plugin
Created: 2019-03-23 11:32
Priority: Minor Minor
Reporter: Ulli Hafner
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

ullrich.hafner@gmail.com (JIRA)

unread,
Mar 28, 2019, 5:32:05 AM3/28/19
to jenkinsc...@googlegroups.com
Ulli Hafner updated an issue
Change By: Ulli Hafner
Priority: Minor Major

andipabst25@gmail.com (JIRA)

unread,
Mar 28, 2019, 2:09:02 PM3/28/19
to jenkinsc...@googlegroups.com
Andreas Pabst assigned an issue to Andreas Pabst
Change By: Andreas Pabst
Assignee: Andreas Pabst

andipabst25@gmail.com (JIRA)

unread,
Mar 28, 2019, 2:33:01 PM3/28/19
to jenkinsc...@googlegroups.com
Andreas Pabst assigned an issue to Unassigned

andreas@reiser.fun (JIRA)

unread,
Apr 3, 2019, 8:28:02 AM4/3/19
to jenkinsc...@googlegroups.com
Andreas Reiser assigned an issue to Andreas Reiser
Change By: Andreas Reiser
Assignee: Andreas Reiser

andreas@reiser.fun (JIRA)

unread,
Apr 3, 2019, 8:48:02 AM4/3/19
to jenkinsc...@googlegroups.com
Andreas Reiser commented on Improvement JENKINS-56718
 
Re: Add unit tests for BlameFactory

I have trouble testing this class because it invokes calls to JenkinsFacade that try to access the jenkins instance (which is null and leads to NullPointerExceptions in tests).

Is it ok to refactor the createBlamer() method so that the JenkinsFacade gets passed as an argument and can be mocked? Otherwise there is no possibility of unit testing this class.

andreas@reiser.fun (JIRA)

unread,
Apr 3, 2019, 8:54:01 AM4/3/19
to jenkinsc...@googlegroups.com

Actually I think I can do it without an extra argument. I just noticed the @VisibleForTesting annotation and will use that to prevent public API changes, but I still need to change the original class a bit.

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 3, 2019, 8:54:02 AM4/3/19
to jenkinsc...@googlegroups.com

Yes, this actually is required (and that is the concept around the facade if you have a look at some other usages). When you refactor the method just create an additional overloaded method (package private access with @VisisbleForTesting annotation) so the current client code does not need to change.

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 3, 2019, 10:47:02 AM4/3/19
to jenkinsc...@googlegroups.com

Yes, you are allowed to change the class to make it easier to test.

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 18, 2019, 6:31:03 PM4/18/19
to jenkinsc...@googlegroups.com
Ulli Hafner started work on Improvement JENKINS-56718
 
Change By: Ulli Hafner
Status: Open In Progress

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 18, 2019, 6:38:02 PM4/18/19
to jenkinsc...@googlegroups.com
Change By: Ulli Hafner
Status: In Progress Fixed but Unreleased
Resolution: Fixed

ullrich.hafner@gmail.com (JIRA)

unread,
May 8, 2019, 6:20:09 PM5/8/19
to jenkinsc...@googlegroups.com
Change By: Ulli Hafner
Status: Fixed but Unreleased Resolved
Released As: 5.0.0 (analysis-model and warnings-ng)
Reply all
Reply to author
Forward
0 new messages