DbExporter/src/test/java/org/nmpl/AppTest.java

39 lines
1 KiB
Java
Raw Normal View History

2024-02-17 22:38:33 +05:30
package org.nmpl;
2024-02-18 02:40:02 +05:30
import org.fest.swing.fixture.FrameFixture;
import org.junit.jupiter.api.Test;
import javax.swing.*;
import java.sql.SQLException;
2024-02-17 22:38:33 +05:30
2024-02-18 02:40:02 +05:30
import static org.fest.swing.core.matcher.JButtonMatcher.withText;
import static org.junit.jupiter.api.Assertions.assertTrue;
2024-02-17 22:38:33 +05:30
2024-02-18 02:40:02 +05:30
class AppTest {
private FrameFixture frame;
@Test
void setUp() {
final String dbName = "testDb";
final String username = "root";
final String password = "password";
SwingUtilities.invokeLater(() -> {
DbExporter app = null;
try {
app = new DbExporter(dbName, username, password);
}
catch (SQLException e) {
e.printStackTrace();
}
finally{
frame = new FrameFixture(app);
frame.show();
frame.button(withText("Show Tables")).click();
assertTrue(frame.table().rowCount() >= 2); // Assuming tables are populated
}
});
2024-02-17 22:38:33 +05:30
}
2024-02-18 02:40:02 +05:30
2024-02-17 22:38:33 +05:30
}