Search in sources :

Example 6 with ExpectedDependencies

use of com.github.sevntu.checkstyle.domain.ExpectedDependencies in project methods-distance by sevntu-checkstyle.

the class MethodCallDependencyCheckstyleModuleTest method testMethodCallsInLambda.

@Test
public void testMethodCallsInLambda() throws Exception {
    final DefaultConfiguration dc = createCheckConfig(MethodCallDependencyCheckstyleModule.class);
    final ExpectedDependencies expected = ExpectedDependencies.build().method("m()").callsTo(1).at(8, 43).method("dependency()").get();
    verifyInfo(dc, "InputMethodCallsInLambda.java", expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) ExpectedDependencies(com.github.sevntu.checkstyle.domain.ExpectedDependencies) Test(org.junit.Test)

Example 7 with ExpectedDependencies

use of com.github.sevntu.checkstyle.domain.ExpectedDependencies in project methods-distance by sevntu-checkstyle.

the class MethodCallDependencyCheckstyleModuleTest method testRecursiveMethod.

@Test
public void testRecursiveMethod() throws Exception {
    final DefaultConfiguration dc = createCheckConfig(MethodCallDependencyCheckstyleModule.class);
    final ExpectedDependencies expected = ExpectedDependencies.build().method("method()").callsTo(0).at(6, 14).get();
    verifyInfo(dc, "InputRecursiveMethod.java", expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) ExpectedDependencies(com.github.sevntu.checkstyle.domain.ExpectedDependencies) Test(org.junit.Test)

Example 8 with ExpectedDependencies

use of com.github.sevntu.checkstyle.domain.ExpectedDependencies in project methods-distance by sevntu-checkstyle.

the class MethodCallDependencyCheckstyleModuleTest method testNotThisClassMethodCall.

@Test
public void testNotThisClassMethodCall() throws Exception {
    final DefaultConfiguration dc = createCheckConfig(MethodCallDependencyCheckstyleModule.class);
    final ExpectedDependencies expected = ExpectedDependencies.build().method("method()").method("format(String)").get();
    verifyInfo(dc, "InputMethodNameClashes.java", expected);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) ExpectedDependencies(com.github.sevntu.checkstyle.domain.ExpectedDependencies) Test(org.junit.Test)

Example 9 with ExpectedDependencies

use of com.github.sevntu.checkstyle.domain.ExpectedDependencies in project methods-distance by sevntu-checkstyle.

the class MethodCallDependencyCheckstyleModuleTest method testSimpleDependency.

@Test
public void testSimpleDependency() throws Exception {
    final DefaultConfiguration dc = createCheckConfig(MethodCallDependencyCheckstyleModule.class);
    final ExpectedDependencies dependencies = ExpectedDependencies.build().method("InputSimpleDependency()").callsTo(1).at(6, 17).method("dependant()").callsTo(2).at(10, 18).method("dependency()").callsTo(3).at(14, 29).callsTo(4).at(15, 29).method("dependencyDependency1()").method("dependencyDependency2()").get();
    verifyInfo(dc, "InputSimpleDependency.java", dependencies);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) ExpectedDependencies(com.github.sevntu.checkstyle.domain.ExpectedDependencies) Test(org.junit.Test)

Example 10 with ExpectedDependencies

use of com.github.sevntu.checkstyle.domain.ExpectedDependencies in project methods-distance by sevntu-checkstyle.

the class MethodCallDependencyCheckstyleModuleTest method testMethodSignatures.

@Test
public void testMethodSignatures() throws Exception {
    final DefaultConfiguration dc = createCheckConfig(MethodCallDependencyCheckstyleModule.class);
    final ExpectedDependencies dep = ExpectedDependencies.build().method("m()").method("m(boolean)").method("m(char)").method("m(byte)").method("m(short)").method("m(int)").method("m(long)").method("m(double)").method("m(String)").method("m(String,String)").method("m(String,Integer...)").method("m(Integer...)").method("m(int[])").method("m(Long[])").method("m(List)").method("m(String,List...)").method("m(List[])").method("m(List[]...)").get();
    verifyInfo(dc, "InputMethodSignatures.java", dep);
}
Also used : DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) ExpectedDependencies(com.github.sevntu.checkstyle.domain.ExpectedDependencies) Test(org.junit.Test)

Aggregations

ExpectedDependencies (com.github.sevntu.checkstyle.domain.ExpectedDependencies)11 DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)11 Test (org.junit.Test)10 DependencyInformationConsumerInjector (com.github.sevntu.checkstyle.common.DependencyInformationConsumerInjector)1 BaseCheckTestSupport (com.github.sevntu.checkstyle.domain.BaseCheckTestSupport)1 Dependencies (com.github.sevntu.checkstyle.domain.Dependencies)1 DependencyInformationConsumer (com.github.sevntu.checkstyle.module.DependencyInformationConsumer)1 MethodCallDependencyCheckstyleModule (com.github.sevntu.checkstyle.module.MethodCallDependencyCheckstyleModule)1 Method (com.github.sevntu.checkstyle.ordering.Method)1 MethodOrder (com.github.sevntu.checkstyle.ordering.MethodOrder)1 Checker (com.puppycrawl.tools.checkstyle.Checker)1 Configuration (com.puppycrawl.tools.checkstyle.api.Configuration)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertTrue (org.junit.Assert.assertTrue)1