File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
src/test/java/com/github/daggerok Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 2222
2323@ Slf4j
2424@ DisplayName ("java plain reflection tests" )
25- class JavaReflectionPlainTest {
25+ class PlainJavaReflectionTest {
2626
2727 private static final Function <Throwable , RuntimeException > asRuntimeException = throwable -> {
2828 log .error (throwable .getLocalizedMessage ());
@@ -68,7 +68,8 @@ class JavaReflectionPlainTest {
6868 };
6969
7070 @ Test
71- void find_class_annotation () {
71+ @ DisplayName ("should get classes recursively in given package" )
72+ void test () {
7273 Collection <Class <?>> classes = findAllPackageClasses .apply (getClass ().getPackage ().getName ());
7374 assertThat (classes ).hasSizeGreaterThan (4 );
7475 classes .stream ().map (String ::valueOf ).forEach (log ::info );
Original file line number Diff line number Diff line change 44import lombok .extern .slf4j .Slf4j ;
55import lombok .val ;
66import org .junit .Test ;
7+ import org .junit .jupiter .api .DisplayName ;
78import org .reflections .Reflections ;
89import org .reflections .scanners .SubTypesScanner ;
910
1314import static org .assertj .core .api .Assertions .assertThat ;
1415
1516@ Slf4j
16- public class ReflectionsLibraryUsageTest {
17+ @ DisplayName ("java reflections library tests" )
18+ public class ReflectionsLibraryTest {
1719
1820 private static Function <Throwable , RuntimeException > asRuntimeException =
1921 throwable -> Try .of (() -> new RuntimeException (throwable ))
2022 .onSuccess (e -> log .error (e .getCause ().getLocalizedMessage ()))
2123 .get ();
2224
2325 @ Test
24- public void java_vintage_test_from_java_test_sources () {
25- val classes = new Reflections (getClass (),
26+ @ DisplayName ("should get classes recursively in given package" )
27+ public void test () {
28+ val classes = new Reflections (getClass ().getPackage ().getName (),
2629 new SubTypesScanner (false )).getAllTypes ()
2730 .parallelStream ()
28- .peek (log ::info )
29- .map (s -> Try .of (() -> Class .forName (s ))
30- .getOrElseThrow (asRuntimeException ))
31+ .map (s -> Try .of (() -> Class .forName (s )).getOrElseThrow (asRuntimeException ))
3132 .collect (Collectors .toList ());
3233 assertThat (classes ).hasSizeGreaterThan (4 );
34+ classes .stream ().map (String ::valueOf ).forEach (log ::info );
3335 }
3436}
You can’t perform that action at this time.
0 commit comments