-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added m6_01_assertFinanceClassExistence
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Class<?>> getUtilitiesClass() { | ||
Try<Class<?>> aClass = tryToLoadClass(classToFind); | ||
return aClass.toOptional(); | ||
} | ||
|
||
@Test | ||
public void m6_01_assertFinanceClassExistence() { | ||
final Optional<Class<?>> maybeClass = getUtilitiesClass(); | ||
assertTrue(maybeClass.isPresent(), classToFind + " should be present"); | ||
assertEquals(classToFind, maybeClass.get().getCanonicalName()); | ||
} | ||
} |