Skip to content

Commit

Permalink
cqfn#417 add lcom4 test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
HDouss committed Mar 10, 2020
1 parent b81d11a commit 7a23392
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/test/java/org/jpeek/calculus/java/Lcom4Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
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;

/**
* 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 +64,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 methodMethodCalls(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 IsEqual<>(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

0 comments on commit 7a23392

Please sign in to comment.