-
Notifications
You must be signed in to change notification settings - Fork 81
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
Made XmlMethodCall public and added a test. #451
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2017-2019 Yegor Bugayenko | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package org.jpeek.graph; | ||
|
||
import com.jcabi.xml.XMLDocument; | ||
import java.io.IOException; | ||
import org.cactoos.text.Joined; | ||
import org.hamcrest.core.IsEqual; | ||
import org.junit.jupiter.api.Test; | ||
import org.llorllale.cactoos.matchers.Assertion; | ||
|
||
/** | ||
* Test case for {@link XmlMethodCall}. | ||
* @since 0.44 | ||
*/ | ||
final class XmlMethodCallTest { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vzurauskas Why missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanifieiev JUnit 5 test classes don't have to be public. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vzurauskas Good to know, thanks |
||
|
||
@Test | ||
void hasClassMethodAndArgs() throws IOException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vzurauskas Why missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fanifieiev JUnit 5 test classes don't have to be public. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vzurauskas Good to know, thanks |
||
new Assertion<>( | ||
"Must have class name, method name and args.", | ||
new XmlMethodCall( | ||
new XMLDocument( | ||
new Joined( | ||
"", | ||
"<op code=\"call\">", | ||
" <name>OverloadMethods.methodOne</name>", | ||
" <args>", | ||
" <arg type=\"Ljava/lang/String\">?</arg>", | ||
" <arg type=\"Z\">?</arg>", | ||
" </args>", | ||
"</op>" | ||
).asString() | ||
) | ||
).asString(), | ||
new IsEqual<>( | ||
"OverloadMethods.methodOne.Ljava/lang/String:Z" | ||
) | ||
).affirm(); | ||
} | ||
} |
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.
@vzurauskas Could you please replace
get(0)
withorg.cactoos.scalar.ItemAt
?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.
@fanifieiev Can you explain why? If the goal is to get more object oriented by replacing method calls with object composition, this will not help, because
ItemAt
is aScalar
, and we would still need to callvalue()
on it. This would only introduce an indirection without reducing the number of method calls.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.
@vzurauskas Agree