From ad83ad53c6afa0c20b034b0e2a50757d009f899b Mon Sep 17 00:00:00 2001 From: hhimanshu Date: Sat, 23 May 2020 16:50:02 -0700 Subject: [PATCH] Added m6_01_assertFinanceClassExistence --- src/test/java/com/h2/Module06_Test.java | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/java/com/h2/Module06_Test.java diff --git a/src/test/java/com/h2/Module06_Test.java b/src/test/java/com/h2/Module06_Test.java new file mode 100644 index 000000000..eb1377f01 --- /dev/null +++ b/src/test/java/com/h2/Module06_Test.java @@ -0,0 +1,26 @@ +package com.h2; + +import org.junit.jupiter.api.Test; +import org.junit.platform.commons.function.Try; + +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass; + +public class Module06_Test { + private final String classToFind = "com.h2.Utilities"; + + public Optional> getUtilitiesClass() { + Try> aClass = tryToLoadClass(classToFind); + return aClass.toOptional(); + } + + @Test + public void m6_01_assertFinanceClassExistence() { + final Optional> maybeClass = getUtilitiesClass(); + assertTrue(maybeClass.isPresent(), classToFind + " should be present"); + assertEquals(classToFind, maybeClass.get().getCanonicalName()); + } +}