Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Mar 12, 2020
2 parents f646791 + 7dbc588 commit dc1b98d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/test/java/org/jpeek/calculus/java/Lcom4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
import com.jcabi.xml.XML;
import java.io.IOException;
import java.util.HashMap;
import org.hamcrest.core.IsEqual;
import org.cactoos.scalar.ItemAt;
import org.jpeek.FakeBase;
import org.jpeek.skeleton.Skeleton;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.ScalarHasValue;

/**
* Test case for {@link Lcom4}.
* @since 0.30.9
* @todo #412:30min The methodMethodCalls test is asserting the expected LCOM4 value
* for MethodMethodCalls. Let's have more test cases for LCOM4 metric
* to cover more realistic cases.
*/
public final class Lcom4Test {

Expand All @@ -65,18 +65,19 @@ public void createsXmlCalculusWithXpaths() throws IOException {
).affirm();
}

@Test
@ParameterizedTest
@Disabled
public void methodMethodCalls() throws Exception {
@CsvFileSource(resources = "/org/jpeek/calculus/java/lcom4-params.csv")
public void calculatesValue(final String file, final String value) throws Exception {
final XML result = new Lcom4().node(
"", new HashMap<>(0), new Skeleton(
new FakeBase("MethodMethodCalls")
new FakeBase(file)
).xml()
);
new Assertion<>(
"Must create LCOM4 value",
result.xpath("/metric/app/package/class/@value").get(0),
new IsEqual<>("1")
new ItemAt<>(0, result.xpath("/metric/app/package/class/@value")),
new ScalarHasValue<>(value)
).affirm();
}
}
6 changes: 6 additions & 0 deletions src/test/resources/org/jpeek/calculus/java/lcom4-params.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MethodMethodCalls,2
TwoCommonAttributes,2
TwoCommonMethods,2
OverloadMethods,1
OneCommonAttribute,1
MethodsWithDiffParamTypes,4

1 comment on commit dc1b98d

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on dc1b98d Mar 12, 2020

Choose a reason for hiding this comment

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

Puzzle 412-a459088d disappeared from src/test/java/org/jpeek/calculus/java/Lcom4Test.java, that's why I closed #417. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.