Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
cd6f6b7a
Commit
cd6f6b7a
authored
Mar 22, 2019
by
Ahmed Ashour
Committed by
skylot
Mar 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add NotYetImplemented feature (PR #495)
parent
cdaecb31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
NotYetImplemented.java
jadx-core/src/test/java/jadx/NotYetImplemented.java
+24
-0
NotYetImplementedExtension.java
jadx-core/src/test/java/jadx/NotYetImplementedExtension.java
+39
-0
No files found.
jadx-core/src/test/java/jadx/NotYetImplemented.java
0 → 100644
View file @
cd6f6b7a
package
jadx
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* Indicates a test which is known to fail.
*
* <p>This would cause a failure to be considered as success and a success as failure,
* with the benefit of updating the related issue when it has been resolved even unintentionally.</p>
*
* <p>To have an effect, the test class must be annotated with:
*
* <code>
* @ExtendWith(NotYetImplementedExtension.class)
* </code>
* </p>
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
({
ElementType
.
TYPE
,
ElementType
.
METHOD
})
public
@interface
NotYetImplemented
{
}
jadx-core/src/test/java/jadx/NotYetImplementedExtension.java
0 → 100644
View file @
cd6f6b7a
package
jadx
;
import
java.lang.reflect.Method
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.junit.jupiter.api.extension.AfterTestExecutionCallback
;
import
org.junit.jupiter.api.extension.ExtensionContext
;
import
org.junit.jupiter.api.extension.TestExecutionExceptionHandler
;
public
class
NotYetImplementedExtension
implements
AfterTestExecutionCallback
,
TestExecutionExceptionHandler
{
private
Set
<
Method
>
knownFailedMethods
=
new
HashSet
<>();
@Override
public
void
handleTestExecutionException
(
ExtensionContext
context
,
Throwable
throwable
)
throws
Throwable
{
if
(!
isNotYetImplemented
(
context
))
{
throw
throwable
;
}
knownFailedMethods
.
add
(
context
.
getTestMethod
().
get
());
}
@Override
public
void
afterTestExecution
(
ExtensionContext
context
)
throws
Exception
{
if
(!
knownFailedMethods
.
contains
(
context
.
getTestMethod
().
get
())
&&
isNotYetImplemented
(
context
)
&&
!
context
.
getExecutionException
().
isPresent
())
{
throw
new
AssertionError
(
"Test "
+
context
.
getTestClass
().
get
().
getName
()
+
'.'
+
context
.
getTestMethod
().
get
().
getName
()
+
" is marked as @NotYetImplemented, but passes!"
);
}
}
private
static
boolean
isNotYetImplemented
(
ExtensionContext
context
)
{
return
context
.
getTestMethod
().
get
().
getAnnotation
(
NotYetImplemented
.
class
)
!=
null
||
context
.
getTestClass
().
get
().
getAnnotation
(
NotYetImplemented
.
class
)
!=
null
;
}
}
Write
Preview
Markdown
is supported
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