Skip to content

Commit

Permalink
DeclarativeOrderTestClassTest
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Sep 16, 2023
1 parent 97276c2 commit 2f69f4b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 2 deletions.
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
Supplementary extension to JUnit patterns, providing common functions and abstractions related to unit testing.
</description>
<dependencies>
<dependency>
<groupId>org.libj</groupId>
<artifactId>lang</artifactId>
<version>0.8.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.29.2-GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openjax.xml</groupId>
<artifactId>dom</artifactId>
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/libj/test/DeclarativeOrderTestClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ protected void scanAnnotatedMembers(final Map<Class<? extends Annotation>,List<F
for (int i = 0, i$ = frameworkMethods.size(); i < i$; ++i) // [RA]
methods[i] = frameworkMethods.get(i).getMethod();

if (!Classes.sortDeclarativeOrder(methods))
throw new IllegalStateException("Javassist is not present on the system classpath, or line number information is unavailable in the bytecode");
try {
Classes.sortDeclarativeOrder(methods, true);
}
catch (final ClassNotFoundException e) {
throw new IllegalStateException("Javassist is not present on the system classpath", e);
}

for (final Method method : methods) // [A]
addToAnnotationLists(new FrameworkMethod(method), methodsForAnnotations);
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/org/libj/test/DeclarativeOrderTestClassTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright (c) 2023 LibJ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* You should have received a copy of The MIT License (MIT) along with this
* program. If not, see <http://opensource.org/licenses/MIT/>.
*/

package org.libj.test;

import org.junit.runner.RunWith;
import org.libj.lang.DeclarativeOrderTest0;

@RunWith(TestRunner.class)
public class DeclarativeOrderTestClassTest extends DeclarativeOrderTest0 {
}
26 changes: 26 additions & 0 deletions src/test/java/org/libj/test/TestRunner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Copyright (c) 2023 LibJ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* You should have received a copy of The MIT License (MIT) along with this
* program. If not, see <http://opensource.org/licenses/MIT/>.
*/

package org.libj.test;

import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.InitializationError;

public class TestRunner extends BlockJUnit4ClassRunner {
public TestRunner(final Class<?> testClass) throws InitializationError {
super(new DeclarativeOrderTestClass(testClass));
}
}

0 comments on commit 2f69f4b

Please sign in to comment.