JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
-
+
private FTSRestClient ftsRestClient;
@BeforeMethod(alwaysRun = true)
public void tearDown() throws Exception
{
}
-
+
@Test
public void getAllDefaulDisplayedDataColumns()
- {
+ {
// to change when resources.tdbeacons_data_columns.txt is changed
- Assert.assertNotNull(ftsRestClient
- .getAllDefaultDisplayedFTSDataColumns());
- System.out.println(ftsRestClient.getAllDefaultDisplayedFTSDataColumns());
+ Assert.assertNotNull(
+ ftsRestClient.getAllDefaultDisplayedFTSDataColumns());
+ System.out
+ .println(ftsRestClient.getAllDefaultDisplayedFTSDataColumns());
Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
.isEmpty());
- Assert.assertEquals(ftsRestClient
- .getAllDefaultDisplayedFTSDataColumns().size(), 11);
+ Assert.assertEquals(
+ ftsRestClient.getAllDefaultDisplayedFTSDataColumns().size(),
+ 11);
}
-
+
@Test(groups = { "Functional" })
public void getPrimaryKeyColumIndexTest()
{
foundIndex = ftsRestClient.getPrimaryKeyColumIndex(wantedFields,
false);
Assert.assertEquals(foundIndex, 10);
- foundIndex = ftsRestClient
- .getPrimaryKeyColumIndex(wantedFields, true);
+ foundIndex = ftsRestClient.getPrimaryKeyColumIndex(wantedFields,
+ true);
Assert.assertEquals(foundIndex, 11);
} catch (Exception e)
{
Assert.fail("Exception thrown while testing...");
}
}
-
+
@Test(groups = { "Functional" })
public void getDataColumnsFieldsAsCommaDelimitedString()
{
Assert.assertEquals(actual,
"model_identifier,provider,model_category,uniprot_start,uniprot_end,resolution,qmean_avg_local_score,coverage,created,entry_name,model_url");
}
-
+
@Test(groups = { "Functional" })
public void getAllFTSDataColumns()
{
Collection<FTSDataColumnI> allFields = ftsRestClient
.getAllFTSDataColumns();
Assert.assertNotNull(allFields);
- //System.out.println(allFields.size());
+ // System.out.println(allFields.size());
Assert.assertEquals(allFields.size(), 15);
}
-
+
@Test(groups = { "Functional" })
public void getSearchableDataColumns()
- {
+ {
// to change when resources.tdbeacons_data_columns.txt is changed
Collection<FTSDataColumnI> searchableFields = ftsRestClient
.getSearchableDataColumns();
Assert.assertNotNull(searchableFields);
- //System.out.println(searchableFields.size());
- Assert.assertEquals(searchableFields.size(), 1); //only 1: uniprot accession
+ // System.out.println(searchableFields.size());
+ Assert.assertEquals(searchableFields.size(), 1); // only 1: uniprot
+ // accession
}
-
+
@Test(groups = { "Functional" })
public void getPrimaryKeyColumn()
- {
+ {
// to change when resources.tdbeacons_data_columns.txt is changed
FTSDataColumnI expectedPKColumn;
try
{
- expectedPKColumn = ftsRestClient
- .getDataColumnByNameOrCode("Url");
+ expectedPKColumn = ftsRestClient.getDataColumnByNameOrCode("Url");
Assert.assertNotNull(ftsRestClient.getPrimaryKeyColumn());
Assert.assertEquals(ftsRestClient.getPrimaryKeyColumn(),
expectedPKColumn);
Assert.fail("Exception thrown while testing...");
}
}
-
+
@Test(groups = { "Functional" })
public void getDataColumnByNameOrCode()
{
Assert.fail("Exception thrown while testing...");
}
}
-
+
@Test(groups = { "Functional" })
public void getDataColumnGroupById()
{
e.printStackTrace();
}
}
-
+
@Test(groups = { "Functional" })
public void getDefaultResponsePageSize()
{
int defaultResSize = ftsRestClient.getDefaultResponsePageSize();
- Assert.assertEquals(defaultResSize, 100); //why 100 or 500 ? pdb is 100, uniprot 500
+ Assert.assertEquals(defaultResSize, 100); // why 100 or 500 ? pdb is 100,
+ // uniprot 500
}
-
+
@Test(groups = { "Functional" })
public void getColumnMinWidthTest()
{
}
}
// could add test for MaxWidth & PreferedWith
-
+
@Test(groups = { "Functional" })
public void getColumnClassTest()
{
Assert.fail("Exception thrown while testing...");
}
}
-
+
@Test(groups = { "Functional" })
public void coverageForEqualsAndHashFunction()
{
uniqueSet.add(foundCol);
}
Assert.assertTrue(!uniqueSet.isEmpty());
- //Assert.assertEquals(uniqueSet.size(), 22); -> 1 or 2 currently for 3DB
+ // Assert.assertEquals(uniqueSet.size(), 22); -> 1 or 2 currently for 3DB
}
-
+
@Test(groups = { "Functional" })
public void getTDBIdColumIndexTest()
{
{
assertEquals(4, TDBeaconsFTSRestClient.getInstance()
.getPrimaryKeyColumIndex(wantedFields, true));
-// assertEquals(3, TDBeaconsFTSRestClient.getInstance()
-// .getPrimaryKeyColumIndex(wantedFields, true));
+ // assertEquals(3, TDBeaconsFTSRestClient.getInstance()
+ // .getPrimaryKeyColumIndex(wantedFields, true));
} catch (Exception e)
{
e.printStackTrace();
// check 404 behaviour
request.setSearchTerm("P00000.json");
+ try
+ {
+ response = TDBeaconsFTSRestClient.getInstance()
+ .executeRequest(request);
- try {
- response = TDBeaconsFTSRestClient.getInstance().executeRequest(request);
-
assertNull(response);
} catch (Exception e)
{
e.printStackTrace();
Assert.fail("Unexpected failure during mock 3DBeacons 404 test");
}
-
+
// check 200 behaviour
request.setSearchTerm("P38398.json");
System.out.println("request : " + request.getFieldToSearchBy());
- //System.out.println(request.toString());
+ // System.out.println(request.toString());
try
{
- response = TDBeaconsFTSRestClient.getInstance().executeRequest(request);
+ response = TDBeaconsFTSRestClient.getInstance()
+ .executeRequest(request);
} catch (Exception e)
{
e.printStackTrace();
return;
}
assertTrue(response.getSearchSummary() != null);
- assertTrue(response.getNumberOfItemsFound() > 3); //4 atm
+ assertTrue(response.getNumberOfItemsFound() > 3); // 4 atm
System.out.println("Search summary : \n" + response.getSearchSummary());
-
- //System.out.println(response.getSearchSummary().size());
+
+ // System.out.println(response.getSearchSummary().size());
}
- @Test(groups = { "External", "Network" })
+ @Test(groups = { "External", "Network" })
public void executeRequestTest()
{
List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
request.setSearchTerm("P01318.json");
request.setWantedFields(wantedFields);
System.out.println("request : " + request.getFieldToSearchBy());
- //System.out.println(request.toString());
+ // System.out.println(request.toString());
FTSRestResponse response;
try
{
- response = TDBeaconsFTSRestClient.getInstance().executeRequest(request);
+ response = TDBeaconsFTSRestClient.getInstance()
+ .executeRequest(request);
} catch (Exception e)
{
e.printStackTrace();
return;
}
assertTrue(response.getSearchSummary() != null);
- assertTrue(response.getNumberOfItemsFound() > 3); //4 atm
+ assertTrue(response.getNumberOfItemsFound() > 3); // 4 atm
System.out.println("Search summary : \n" + response.getSearchSummary());
- //System.out.println(response.getSearchSummary().size());
+ // System.out.println(response.getSearchSummary().size());
}
}