-
Notifications
You must be signed in to change notification settings - Fork 127
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
feat(#2217): Apply FakeMaven in AssembleMojoTest #2221
feat(#2217): Apply FakeMaven in AssembleMojoTest #2221
Conversation
…ilOnErrorFlag test
…leIfFailOnErrorFlagIsTrue
e1c5bfb
to
fc73673
Compare
fc73673
to
f7a4a18
Compare
@maxonfjvipon Could you take a look, please? |
eo-maven-plugin/src/main/java/org/eolang/maven/RegisterMojo.java
Outdated
Show resolved
Hide resolved
eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java
Outdated
Show resolved
Hide resolved
eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java
Outdated
Show resolved
Hide resolved
eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java
Outdated
Show resolved
Hide resolved
# Conflicts: # eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java # eo-maven-plugin/src/test/java/org/eolang/maven/RegisterMojoTest.java
@maxonfjvipon Could you take a look one more time, please? |
* @return The same maven instance. | ||
*/ | ||
FakeMaven withoutDefaults() { | ||
return new FakeMaven(this.workspace, this.params, this.attributes, this.current, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@volodya-lombrozo Do you think it's a good idea to return a new instance of FakeMaven
here? It looks like in order to get FakeMaven
without defaults you need to create first one with defaults and then call this method (like you did in test throwsExceptionInCaseSourceDirIsNotSet
).
It's up to you but I would remove the method and uses constructor with 2 arguments in tests instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maxonfjvipon To be honest, it's a good suggestion. Thank you. However, I'm trying to hide that fact that FakeMaven
is a configurable object:
https://www.yegor256.com/2016/04/19/object-must-not-be-configurable.html
Moreover, since FakeMaven
implements some sort of the builder pattern, I believe that it's convenient to keep the corresponding style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@volodya-lombrozo then I have no more questions, thanks.
@volodya-lombrozo One comment from my side, see above |
@yegor256 could you please merge these changes? |
@yegor256 Could you merge that changes please? |
@@ -108,6 +108,7 @@ public final class RegisterMojo extends SafeMojo { | |||
|
|||
@Override | |||
public void exec() throws IOException { | |||
this.verifyPrerequisite(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yegor256 I've inlined that method and added |
@yegor256 Reminder |
if (this.scopedTojos().contains(name)) { | ||
Logger.debug(this, "EO source %s already registered", name); | ||
continue; | ||
if (this.sourcesDir == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yegor256 Done. Thanks
# Conflicts: # eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java
@yegor256 Could you merge that changes, please? |
@rultor merge |
I've applied
FakeMaven
forAssembleMojoTest
and added checking prerequisites forRegisterMojo
in order to show more meaningful message instead of justNullPointerException
.Closes: #2217
PR-Codex overview
This PR focuses on improving the AssembleMojoTest by using the FakeMaven class.
Detailed summary: