Skip to content

Commit 8424665

Browse files
committed
one more test when URL has no schema specified
1 parent 25ac809 commit 8424665

File tree

1 file changed

+18
-0
lines changed
  • src/test/java/com/geckotechnology/mySqlDataCompare

1 file changed

+18
-0
lines changed

src/test/java/com/geckotechnology/mySqlDataCompare/AppTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
public class AppTest extends TestCase
1313
{
14+
private static final String MASTER_URL_NO_SCHEMA = "jdbc:mysql://localhost:3306?user=usertestA&password=password";
1415
private static final String MASTER_URL = "jdbc:mysql://localhost:3306/schema_a?user=usertestA&password=password";
1516
private static final String SLAVE_URL = "jdbc:mysql://localhost:3306/schema_b?user=usertestB&password=password";
1617

@@ -109,4 +110,21 @@ public void testCompareSchemaAndData() throws Exception
109110
assertTrue(tableDataComparer.getMasterTotalRetrievedRows() > 900000);
110111
assertTrue(tableDataComparer.getSlaveTotalRetrievedRows() > 900000);
111112
}
113+
114+
public void testURLWithoutSchema() {
115+
MySQLSchemaRetriever retriever = null;
116+
try {
117+
retriever = new MySQLSchemaRetriever(MASTER_URL_NO_SCHEMA);
118+
retriever.openConnection();
119+
retriever.retrieveMetaData();
120+
fail("MySQLSchemaRetriever should fail when there is no schema specified in URL");
121+
} catch (Exception e) {
122+
assertEquals(e.getMessage(), "Schema not defined in URL");
123+
try {
124+
retriever.closeConnection();
125+
} catch (Exception e1) {
126+
}
127+
}
128+
}
129+
112130
}

0 commit comments

Comments
 (0)