assertEquals(bFormal,!props.isExperimentInformal());
}
public void testLiteratureReference(){
BasicProperties props = new BasicPropertiesImpl();
//Test1:
assertEquals(0,props.getAllLiteratureReferences().size());
//Test2:
String sTitle = "Digital Long Term Preservation";
String sURI = "ISBN: 20-323-3233";
props.addLiteratureReference(sTitle, sURI);
List<String[]> refs = props.getAllLiteratureReferences();
Iterator<String[]> itElement = refs.iterator();
while(itElement.hasNext()){
String[] element = itElement.next();
assertEquals(1,refs.size());
assertEquals(sTitle,element[0]);
assertEquals(sURI,element[1]);
}
//Test3:
String sTitle2 = "Digital Long Term Preservation2";
String sURI2 = "ISBN: 20-323-3233";
props.addLiteratureReference(sTitle2, sURI2);
//Element should have been added:
assertEquals(2,props.getAllLiteratureReferences().size());
props.addLiteratureReference(sTitle2, sURI2);
//Duplicate element should not have been added:
assertEquals(2,props.getAllLiteratureReferences().size());
//Test4:
String sTitle3 = "Comic Book";
String sURI3 = "ISBN: 111111";
props.addLiteratureReference(sTitle3, sURI3);
//Element should not have been added:
assertEquals(3,props.getAllLiteratureReferences().size());
props.removeLiteratureReference(sTitle,sURI);
assertEquals(2,props.getAllLiteratureReferences().size());
String sTitle4 = "Title Website1";
String sURI4 = "http://localhost:8080";
Vector<String[]> vAdd = new Vector<String[]>();
vAdd.add(new String[]{sTitle4,sURI4});
try {
props.setLiteratureReferences(vAdd);
} catch (InvalidInputException e) {
assertEquals(true,false);
}
//Element should not have been added:
assertEquals(1,props.getAllLiteratureReferences().size());
String sTitle5 = "Title Website2";
String sURI5 = "http://localhost:8080/jsf";
vAdd.add(new String[]{sTitle5,sURI5});
try {
props.setLiteratureReferences(vAdd);
} catch (InvalidInputException e) {
assertEquals(true,false);
}
assertEquals(2,props.getAllLiteratureReferences().size());
}