@Test public void singlePairTest() { Set<String> input = new HashSet<>(); input.add("PLNUSD"); String output = builder.constructSelectQuery(input); Assert.assertEquals( "select id, Rate, Ask, Bid from yahoo.finance.xchange where pair in (\"PLNUSD\")", output); }
@Test public void multiplePairsTest() { Set<String> input = new HashSet<>(); input.add("PLNUSD"); input.add("PLNEUR"); String output = builder.constructSelectQuery(input); Assert.assertTrue( output.startsWith("select id, Rate, Ask, Bid from yahoo.finance.xchange where pair in (")); Assert.assertTrue(output.contains("PLNUSD")); // \"PLNUSD\", \"PLNEUR\")", output); Assert.assertTrue(output.contains("PLNEUR")); Assert.assertTrue(output.endsWith(")")); }
@Test public void emptyInputTest() { String output = builder.constructSelectQuery(Collections.<String>emptySet()); Assert.assertEquals("", output); }
@Test public void nullInputTest() { String output = builder.constructSelectQuery(null); Assert.assertEquals("", output); }