Skip to content

Commit

Permalink
#97 more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 21, 2018
1 parent 8814704 commit af325fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/test/java/org/jpeek/MetricsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public static Collection<Object[]> targets() {
new Object[] {"TwoCommonAttributes", "LCOM", 3.0d},
new Object[] {"WithoutAttributes", "LCOM", 0.0d},
new Object[] {"OneMethodCreatesLambda", "LCOM", 1.0d},
new Object[] {"Bar", "MMAC", 1.0d},
new Object[] {"Bar", "MMAC", 0.0d},
new Object[] {"Foo", "MMAC", 1.0d},
new Object[] {"MethodsWithDiffParamTypes", "MMAC", 0.037d},
new Object[] {"MethodsWithDiffParamTypes", "MMAC", 0.0d},
new Object[] {"NoMethods", "MMAC", 0.0d},
new Object[] {"OneVoidMethodWithoutParams", "MMAC", 0.0d},
new Object[] {"OverloadMethods", "MMAC", 0.7222d},
new Object[] {"OverloadMethods", "MMAC", 0.3889d},
new Object[] {"TwoCommonAttributes", "MMAC", 0.3333d},
new Object[] {"WithoutAttributes", "MMAC", 1.0d},
new Object[] {"OneMethodCreatesLambda", "MMAC", 0.0d}
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/jpeek/SkeletonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ public void findsMethodsAndArgs() throws IOException {
).xml().toString()
),
XhtmlMatchers.hasXPaths(
// @checkstyle LineLength (10 lines)
"//class/methods[count(method)=7]",
"//method[@name='methodSix']/args[count(arg)=1]",
// @checkstyle LineLength (1 line)
"//method[@name='methodSix']/args/arg[@type='Ljava/sql/Timestamp']",
"//method[@name='methodSix' and return='Ljava/util/Date']"
"//method[@name='methodSix' and return='Ljava/util/Date']",
"//method[@name='methodTwo' and return='V']",
"//method[@name='methodOne']/args/arg[@type='Ljava/lang/Object']"
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ public final class MethodsWithDiffParamTypes {

private int num;

public double methodOne(final String src) {
public <T> double methodOne(final T src) {
++num;
return num * 2.4d;
}

public double methodTwo(final long count) {
public void methodTwo(final long count) {
++num;
return num * count;
}

public char methodThree(final String src, final int count) {
Expand All @@ -28,4 +27,4 @@ public int[] methodFive(final Integer[] arr) {
public java.util.Date methodSix(final java.sql.Timestamp ts) {
return new java.util.Date(ts.getTime());
}
}
}

0 comments on commit af325fb

Please sign in to comment.