fix @Delegate tests

This commit is contained in:
Max Medvedev
2012-11-14 15:48:58 +04:00
parent 66abef6a86
commit f3d7b5ea2a
2 changed files with 20 additions and 16 deletions
@@ -731,20 +731,6 @@ new Base() {
''')
}
void testDelegateWithDeprecated() {
testHighlighting('''\
interface Foo {
@Deprecated
void foo()
}
<error descr="Method 'foo' is not implemented">class FooImpl implements Foo</error> {
@Delegate(deprecated = false) Foo delegate
}
''')
}
void testAbstractMethodWithBody() {
testHighlighting('''\
interface A {
@@ -241,16 +241,34 @@ public abstract class Bar implements Foo {
public class FooBar extends Bar implements Foo {
}
''')
def file = myFixture.configureByText('Baz.groovy', '''\
assertAllMethodsImplemented('Baz.groovy', '''\
class Baz {
@Delegate(deprecated = true)
FooBar bare
}
''') as GroovyFile
''')
}
private void assertAllMethodsImplemented(String fileName, String text) {
def file = myFixture.configureByText(fileName, text) as GroovyFile
assertNotNull(file)
final clazz = file.classes[0]
assertNotNull(clazz)
assertEmpty OverrideImplementUtil.getMethodSignaturesToImplement(clazz)
}
void testDeprecatedFalse() {
myFixture.addFileToProject('Foo.groovy', '''\
interface Foo {
@Deprecated
void foo()
}
''')
assertAllMethodsImplemented('text.groovy', '''\
class FooImpl implements Foo {
@Delegate(deprecated = false) Foo delegate
}
''')
}
}