-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* 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.XML; | ||
import org.cactoos.text.Joined; | ||
import org.cactoos.text.TextEnvelope; | ||
import org.cactoos.text.TextOf; | ||
|
||
/** | ||
* Text signature of a class method, extracted from XML Skeleton. | ||
* @since 0.30.9 | ||
*/ | ||
public final class XmlMethodSignature extends TextEnvelope { | ||
|
||
/** | ||
* Ctor. | ||
* @param clazz The class element of XML skeleton. | ||
* @param method The method element of XML skeleton. | ||
*/ | ||
public XmlMethodSignature(final XML clazz, final XML method) { | ||
super( | ||
new Joined( | ||
new TextOf("."), | ||
new TextOf(clazz.xpath("./@id").get(0)), | ||
new TextOf(method.xpath("@name").get(0)), | ||
new XmlMethodArgs(method) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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.XML; | ||
import org.hamcrest.core.IsEqual; | ||
import org.jpeek.FakeBase; | ||
import org.jpeek.skeleton.Skeleton; | ||
import org.junit.jupiter.api.Test; | ||
import org.llorllale.cactoos.matchers.Assertion; | ||
|
||
/** | ||
* Test case for {@link XmlMethodSignature}. | ||
* @since 0.30.9 | ||
*/ | ||
final class XmlMethodSignatureTest { | ||
|
||
@Test | ||
void givesArgsForMultipleArgs() throws Exception { | ||
final XML skeleton = new Skeleton( | ||
new FakeBase("MethodsWithDiffParamTypes") | ||
).xml(); | ||
new Assertion<>( | ||
"Must create method signature with multiple arguments.", | ||
new XmlMethodSignature( | ||
skeleton.nodes("//class").get(0), | ||
skeleton.nodes("//method[@name='methodThree']").get(0) | ||
).asString(), | ||
new IsEqual<>( | ||
"MethodsWithDiffParamTypes.methodThree.Ljava/lang/String:I" | ||
) | ||
).affirm(); | ||
} | ||
} |
05d4100
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.
Puzzle
444-ff900aeb
disappeared fromsrc/test/java/org/jpeek/graph/XmlMethodArgsTest.java
, that's why I closed #459. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.05d4100
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.
Puzzle
441-ed4884a5
disappeared fromsrc/main/java/org/jpeek/graph/XmlGraph.java
, that's why I closed #445. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.05d4100
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.
Puzzle
445-b9bbd966
discovered insrc/main/java/org/jpeek/graph/XmlGraph.java
and submitted as #472. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.05d4100
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.
Puzzle
445-1cfd81f6
discovered insrc/main/java/org/jpeek/graph/XmlGraph.java
and submitted as #473. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.