package base;
public class Tests {
public static void main(String[] args){
Tests t = new Tests();
t.NodeTest();
}
public boolean NodeTest(){
System.out.println("Node Tests");
System.out.println("-----------------");
Node a = new Node("Test Label", 54321);
Node b = new Node(a.getID());
//Test to see that we can create new nodes
//and retrieve nodes in the database
System.out.print("Node Creation and Retrieval : ");
if (a.getID() == b.getID() && //Check ID's
a.getLabel().equals(b.getLabel()) && //Check Labels
a.getTemplateID() == b.getTemplateID() //Check TemplateID's
) {System.out.println("OK");}
else {
System.out.println("Failed!");
return false; }
//Test to see that the setter methods update the
//database successfully
a.setLabel("TESTING");
a.setTemplateID(12345);
System.out.print("Get and Set : ");
if(b.getLabel().equals("TESTING") &&
b.getTemplateID() == 12345){
System.out.println("OK");
}
else {
System.out.println("Failed!");
return false;
}
return true;
}
}
syntax highlighted by Code2HTML, v. 0.93pm6