diff --git a/src/test/java/edu/harvard/iq/dataverse/api/SwordIT.java b/src/test/java/edu/harvard/iq/dataverse/api/SwordIT.java
index 4df6c89411d..518431bfa2d 100644
--- a/src/test/java/edu/harvard/iq/dataverse/api/SwordIT.java
+++ b/src/test/java/edu/harvard/iq/dataverse/api/SwordIT.java
@@ -462,7 +462,7 @@ public void testCreateAndDeleteDatasetInRoot() {
             assertNull(attemptToGetFileId);
         } catch (Exception ex) {
             System.out.println("We expect an exception here because we can no longer find the file because deleted it: " + ex);
-            assertTrue(ex.getClass().getName().equals(ArrayIndexOutOfBoundsException.class.getName()));
+            assertTrue(ex instanceof ArrayIndexOutOfBoundsException);
         }
 
         String newTitle = "A New Hope";
diff --git a/src/test/java/edu/harvard/iq/dataverse/util/bagit/data/FileDataProviderFactoryTest.java b/src/test/java/edu/harvard/iq/dataverse/util/bagit/data/FileDataProviderFactoryTest.java
index f43a0c78284..9fac4d42bcd 100644
--- a/src/test/java/edu/harvard/iq/dataverse/util/bagit/data/FileDataProviderFactoryTest.java
+++ b/src/test/java/edu/harvard/iq/dataverse/util/bagit/data/FileDataProviderFactoryTest.java
@@ -23,21 +23,21 @@ public class FileDataProviderFactoryTest {
     public void should_return_FolderDataProvider_when_parameter_is_path() {
         FileDataProvider result = target.getFileDataProvider(Path.of(UUID.randomUUID().toString()));
 
-        MatcherAssert.assertThat(result.getClass().getName(), Matchers.is(FolderDataProvider.class.getName()));
+        MatcherAssert.assertThat("should return FolderDataProvider when parameter is path", result instanceof FolderDataProvider);
     }
 
     @Test
     public void should_return_ZipFileDataProvider_when_parameter_is_file() throws IOException {
         FileDataProvider result = target.getFileDataProvider(Path.of(FIXTURE_DIRECTORY, "FileDataProviderFactoryTest.zip").toFile());
 
-        MatcherAssert.assertThat(result.getClass().getName(), Matchers.is(ZipFileDataProvider.class.getName()));
+        MatcherAssert.assertThat("should return ZipFileDataProvider when parameter is file", result instanceof ZipFileDataProvider);
     }
 
     @Test
     public void should_return_DataFileDataProvider_when_parameter_is_datafiles() {
         FileDataProvider result = target.getFileDataProvider("test-name", Collections.emptyList());
 
-        MatcherAssert.assertThat(result.getClass().getName(), Matchers.is(DataFileDataProvider.class.getName()));
+        MatcherAssert.assertThat("should return DataFileDataProvider when parameter is datafiles", result instanceof DataFileDataProvider);
     }
 
 }
\ No newline at end of file