IDEA-179516 "Previous Method" skips methods in anonymous classes

This commit is contained in:
peter
2017-10-11 22:01:07 +02:00
parent 18b13d1479
commit 75ee2ffe59
2 changed files with 36 additions and 18 deletions
@@ -0,0 +1,30 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.codeInsight.navigation
import com.intellij.codeInsight.navigation.MethodUpDownUtil
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
/**
* @author peter
*/
class JavaMemberNavigationTest extends LightCodeInsightFixtureTestCase {
void "test include anonymous and local classes"() {
def file = myFixture.configureByText('a.java', '''
class Foo {
void bar() {
new Runnable() {
void run() {}
};
class Local {
void localMethod() {}
}
}
}
''')
def offsets = MethodUpDownUtil.getNavigationOffsets(file, 0)
assert file.text.indexOf('run') in offsets
assert file.text.indexOf('Local') in offsets
assert file.text.indexOf('localMethod') in offsets
}
}