Skip to content

Commit

Permalink
Run hasTestMethods manually for Liquibase
Browse files Browse the repository at this point in the history
  • Loading branch information
reneleonhardt committed Aug 19, 2024
1 parent 3e8a7bb commit db168dc
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
import liquibase.exception.LiquibaseException;
import liquibase.integration.spring.SpringLiquibase;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.internal.runners.util.TestMethodsFinder;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.aop.framework.Advised;

Expand All @@ -45,8 +47,19 @@ public class LiquibaseDatabaseExtensionTest {

private SpringLiquibase liquibase;

@BeforeClass
public static void beforeClass() {
System.out.println("TestMethodsFinder.hasTestMethods(SpringLiquibase.class)...");
boolean hasTestMethods = TestMethodsFinder.hasTestMethods(SpringLiquibase.class);
System.out.println("TestMethodsFinder.hasTestMethods(SpringLiquibase.class): " + hasTestMethods);
System.out.println("TestMethodsFinder.hasTestMethods(LiquibaseException.class)...");
hasTestMethods = TestMethodsFinder.hasTestMethods(LiquibaseException.class);
System.out.println("TestMethodsFinder.hasTestMethods(LiquibaseException.class): " + hasTestMethods);
}

@Before
public void setUp() {
public void setUp() throws ClassNotFoundException {
Class liquibaseException = getClass().getClassLoader().loadClass("liquibase.exception.LiquibaseException");
Advised dataSource = mock(Advised.class, withSettings().extraInterfaces(DataSource.class));
when(dataSource.getTargetSource()).thenReturn(new DatabaseTargetSource(databaseContext));

Expand All @@ -63,4 +76,4 @@ public void testMigrate() throws LiquibaseException {

verify(databaseContext).apply(new LiquibaseDatabasePreparer(LiquibaseDescriptor.from(liquibase)));
}
}
}

0 comments on commit db168dc

Please sign in to comment.