diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java index 449ce7982..29fcf245c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java @@ -60,6 +60,16 @@ public class IndentationCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("indentation/InputAndroidStyle.java"), expected); } + public void testMethodCallLineWrap() throws Exception + { + final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); + final String[] expected = { + "36: 'method call' child have incorrect indentation level 18, expected level should be 20.", + "37: 'method call rparen' have incorrect indentation level 14, expected level should be 16.", + }; + verify(checkConfig, getPath("indentation/InputMethodCallLineWrap.java"), expected); + } + @Test public void testAnonClassesFromGuava() throws Exception { diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/indentation/InputMethodCallLineWrap.java b/src/test/resources/com/puppycrawl/tools/checkstyle/indentation/InputMethodCallLineWrap.java new file mode 100644 index 000000000..4e9235fd3 --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/indentation/InputMethodCallLineWrap.java @@ -0,0 +1,40 @@ +package com.puppycrawl.tools.checkstyle.indentation; + +public class InputMethodCallLineWrap { + + void foo() { + new String() + .substring( + 0, 100 + ) + .substring( + 0, 50 + ); + } + + class InnerFoo { + + void foo() { + new String() + .substring( + 0, 100 + ) + .substring( + 0, 50 + ); + } + } + + InnerFoo anon = new InnerFoo() { + + void foo() { + new String() + .substring( + 0, 100 + ) + .substring( + 0, 50 //incorrect + ); //incorrect + } + }; +}