Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
eded65fe
Commit
eded65fe
authored
6 years ago
by
Sergey Ignatov
Browse files
Options
Download
Email Patches
Plain Diff
test case loader: process annotations though the hierarchy
parent
9f0d25b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform/testFramework/core/src/com/intellij/TestCaseLoader.java
+15
-1
...m/testFramework/core/src/com/intellij/TestCaseLoader.java
plugins/groovy/test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java
+2
-20
...test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java
with
17 additions
and
21 deletions
+17
-21
platform/testFramework/core/src/com/intellij/TestCaseLoader.java
+
15
-
1
View file @
eded65fe
...
...
@@ -18,6 +18,7 @@ import org.jetbrains.annotations.Nullable;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.AnnotatedElement
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
...
...
@@ -246,7 +247,7 @@ public class TestCaseLoader {
}
private
static
boolean
runFirst
(
Class
testClass
)
{
return
testClass
.
getAnnotation
(
RunFirst
.
class
)
!=
null
;
return
getAnnotation
InHierarchy
(
testClass
,
RunFirst
.
class
)
!=
null
;
}
private
static
boolean
isPlatformLiteFixture
(
Class
aClass
)
{
...
...
@@ -320,4 +321,17 @@ public class TestCaseLoader {
System
.
out
.
println
(
message
);
TeamCityLogger
.
info
(
message
);
}
@Nullable
public
static
<
T
extends
Annotation
>
T
getAnnotationInHierarchy
(
@NotNull
Class
<?>
clazz
,
@NotNull
Class
<
T
>
annotationClass
)
{
Class
<?>
current
=
clazz
;
while
(
current
!=
null
)
{
T
annotation
=
current
.
getAnnotation
(
annotationClass
);
if
(
annotation
!=
null
)
{
return
annotation
;
}
current
=
current
.
getSuperclass
();
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
plugins/groovy/test/org/jetbrains/plugins/groovy/util/AllTestsSuite.java
+
2
-
20
View file @
eded65fe
/*
* Copyright 2000-2018 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.
*/
// Copyright 2000-2018 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
org.jetbrains.plugins.groovy.util
;
import
com.intellij.TestAll
;
import
com.intellij.TestCaseLoader
;
import
com.intellij.util.ArrayUtil
;
import
com.intellij.util.containers.ContainerUtil
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
org.junit.runners.Suite
;
import
org.junit.runners.model.InitializationError
;
import
org.junit.runners.model.RunnerBuilder
;
import
java.lang.annotation.Annotation
;
import
java.util.List
;
/**
...
...
@@ -51,19 +46,6 @@ public class AllTestsSuite extends Suite {
}
private
static
boolean
isSlow
(
Class
aClass
)
{
return
getAnnotationInHierarchy
(
aClass
,
Slow
.
class
)
!=
null
;
}
@Nullable
private
static
<
T
extends
Annotation
>
T
getAnnotationInHierarchy
(
@NotNull
Class
<?>
clazz
,
@NotNull
Class
<
T
>
annotationClass
)
{
Class
<?>
current
=
clazz
;
while
(
current
!=
null
)
{
T
annotation
=
current
.
getAnnotation
(
annotationClass
);
if
(
annotation
!=
null
)
{
return
annotation
;
}
current
=
current
.
getSuperclass
();
}
return
null
;
return
TestCaseLoader
.
getAnnotationInHierarchy
(
aClass
,
Slow
.
class
)
!=
null
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment