use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.
the class MethodDefinitionTest method testGetterSetterRecognitionsWithCtors.
@Test
public void testGetterSetterRecognitionsWithCtors() throws Exception {
final MethodOrder dc = withDefaultConfigOrdering("InputMethodDefinition2.java");
final Method noArgCtor = dc.getMethodByInitialIndex(0);
assertFalse(noArgCtor.isGetter());
assertFalse(noArgCtor.isSetter());
final Method singleArgCtor = dc.getMethodByInitialIndex(1);
assertFalse(singleArgCtor.isGetter());
assertFalse(singleArgCtor.isSetter());
}
use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.
the class MethodOrderTest method testAccessorsSplit.
@Test
public void testAccessorsSplit() throws Exception {
final MethodOrder ds = withDefaultConfigOrdering("InputDependenciesAccessorsSplit.java");
assertEquals(3, ds.getAccessorsSplitCases());
}
use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.
the class MethodOrderTest method testConstructorsSplit.
@Test
public void testConstructorsSplit() throws Exception {
final MethodOrder order = withDefaultConfigOrdering("InputDependenciesConstructorsSplit.java");
assertEquals(3, order.getCtorGroupsSplitCases());
}
use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.
the class MethodOrderTest method testCallsBetweenDistantMethods.
@Test
public void testCallsBetweenDistantMethods() throws Exception {
final int screenLinesCount = 5;
final Map<String, Integer> expected = new TreeMap<>();
expected.put("InputDependenciesDistantMethodCall1.java", 1);
expected.put("InputDependenciesDistantMethodCall2.java", 2);
expected.put("InputDependenciesDistantMethodCall3.java", 1);
expected.put("InputDependenciesDistantMethodCall4.java", 0);
for (final Map.Entry<String, Integer> e : expected.entrySet()) {
final MethodOrder dependencies = withDefaultConfigOrdering(e.getKey());
final String msg = String.format("Incorrect result for input \"%s\"", e.getKey());
assertEquals(msg, e.getValue().intValue(), dependencies.getDependenciesBetweenDistantMethodsCases(screenLinesCount));
}
}
use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.
the class MethodOrderTest method testOverrideSplit2.
@Test
public void testOverrideSplit2() throws Exception {
final MethodOrder ds = withDefaultConfigOrdering("InputDependenciesOverrideSplit2.java");
assertEquals(0, ds.getOverrideGroupSplitCases());
}
Aggregations