Search in sources :

Example 6 with MethodOrder

use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.

the class MethodOrderTest method testOverrideSplit3.

@Test
public void testOverrideSplit3() throws Exception {
    final MethodOrder ds = withDefaultConfigOrdering("InputDependenciesOverrideSplit3.java");
    assertEquals(0, ds.getOverrideGroupSplitCases());
}
Also used : MethodOrder(com.github.sevntu.checkstyle.ordering.MethodOrder) Test(org.junit.Test)

Example 7 with MethodOrder

use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.

the class MethodOrderTest method testDependencies.

@Test
public void testDependencies() throws Exception {
    final Configuration dc = createCheckConfig(MethodCallDependencyCheckstyleModule.class);
    final MethodOrder ord = invokeCheckAndGetOrdering(dc, "InputDependencies.java");
    final Method methodB = ord.getMethodByInitialIndex(1);
    final List<Method> dependencies = ord.getMethodDependenciesInAppearanceOrder(methodB);
    assertTrue(dependencies.size() == 1);
    assertTrue(dependencies.get(0).getSignature().equals("c()"));
    final List<Method> dependants = ord.getMethodDependants(methodB);
    assertTrue(dependants.size() == 1);
    assertTrue(dependants.get(0).getSignature().equals("a()"));
    final Method methodD = ord.getMethodByInitialIndex(3);
    assertFalse(ord.hasMethodDependants(methodD));
    assertFalse(ord.hasMethodDependencies(methodD));
    final Method methodA = ord.getMethodByInitialIndex(0);
    assertTrue(ord.isMethodDependsOn(methodA, methodB));
    assertFalse(ord.isMethodDependsOn(methodA, methodD));
}
Also used : Configuration(com.puppycrawl.tools.checkstyle.api.Configuration) MethodOrder(com.github.sevntu.checkstyle.ordering.MethodOrder) Method(com.github.sevntu.checkstyle.ordering.Method) Test(org.junit.Test)

Example 8 with MethodOrder

use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.

the class MethodOrderTest method testDeclarationBeforeUsageCases.

@Test
public void testDeclarationBeforeUsageCases() throws Exception {
    final MethodOrder ds = withDefaultConfigOrdering("InputDependenciesDeclarationBeforeUsage.java");
    assertEquals(2, ds.getDeclarationBeforeUsageCases());
}
Also used : MethodOrder(com.github.sevntu.checkstyle.ordering.MethodOrder) Test(org.junit.Test)

Example 9 with MethodOrder

use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.

the class MethodOrderTest method testTotalSumOfMethodDistances2.

@Test
public void testTotalSumOfMethodDistances2() throws Exception {
    final MethodOrder ds = withDefaultConfigOrdering("InputDependenciesDistance2.java");
    assertEquals(3, ds.getTotalSumOfMethodDistances());
}
Also used : MethodOrder(com.github.sevntu.checkstyle.ordering.MethodOrder) Test(org.junit.Test)

Example 10 with MethodOrder

use of com.github.sevntu.checkstyle.ordering.MethodOrder in project methods-distance by sevntu-checkstyle.

the class MethodOrderTest method testOverloadSplit2.

@Test
public void testOverloadSplit2() throws Exception {
    final MethodOrder ds = withDefaultConfigOrdering("InputDependenciesOverloadSplit2.java");
    assertEquals(14, ds.getOverloadGroupsSplitCases());
}
Also used : MethodOrder(com.github.sevntu.checkstyle.ordering.MethodOrder) Test(org.junit.Test)

Aggregations

MethodOrder (com.github.sevntu.checkstyle.ordering.MethodOrder)23 Test (org.junit.Test)15 Method (com.github.sevntu.checkstyle.ordering.Method)10 ArrayList (java.util.ArrayList)4 Dependencies (com.github.sevntu.checkstyle.domain.Dependencies)3 Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)3 List (java.util.List)3 Map (java.util.Map)3 DependencyInformationConsumer (com.github.sevntu.checkstyle.module.DependencyInformationConsumer)2 Function (java.util.function.Function)2 Collectors (java.util.stream.Collectors)2 DependencyInformationConsumerInjector (com.github.sevntu.checkstyle.common.DependencyInformationConsumerInjector)1 MethodCallDependencyCheckInvoker (com.github.sevntu.checkstyle.common.MethodCallDependencyCheckInvoker)1 BaseCheckTestSupport (com.github.sevntu.checkstyle.domain.BaseCheckTestSupport)1 ExpectedDependencies (com.github.sevntu.checkstyle.domain.ExpectedDependencies)1 AttributeHolder (com.github.sevntu.checkstyle.dot.domain.AttributeHolder)1 Cluster (com.github.sevntu.checkstyle.dot.domain.Cluster)1 Colors (com.github.sevntu.checkstyle.dot.domain.Colors)1 Comment (com.github.sevntu.checkstyle.dot.domain.Comment)1 Edge (com.github.sevntu.checkstyle.dot.domain.Edge)1