CategoryPartitionRemoveNodeSingleGraphIt1.java
package org.graphstream.graph.implementations;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import java.net.URL;
import java.util.Random;
import org.databene.benerator.anno.Source;
import org.databene.feed4junit.Feeder;
import org.graphstream.graph.Edge;
import org.graphstream.graph.ElementNotFoundException;
import org.graphstream.graph.IdAlreadyInUseException;
import org.graphstream.graph.Node;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Feeder.class)
public class CategoryPartitionRemoveNodeSingleGraphIt1 {
//idExistance,idValue,graphNrNodes,graphStrictChecking,nodeDegree
@Rule
public ExpectedException exception = ExpectedException.none();
@Test
@Source("csvFiles/CategoryPartitionRemoveNodeSingleGraph.csv")
public void test(Boolean idExistance, String idValue, String graphNrNodes, Boolean graphStrictChecking, String nodeDegree ) {
if (!idExistance && idValue.equals("correct") && graphNrNodes.equals("many") && graphStrictChecking && nodeDegree.equals("Many")) {
test1();
}else if(idExistance && idValue.equals("correct") && graphNrNodes.equals("many") && graphStrictChecking && nodeDegree.equals("Many")) {
test2();
}else if(!idExistance && idValue.equals("correct") && graphNrNodes.equals("0") && graphStrictChecking && nodeDegree.equals("Many")) {
test3();
}else if(!idExistance && idValue.equals("correct") && graphNrNodes.equals("0") && !graphStrictChecking && nodeDegree.equals("Many")) {
test4();
}else if(!idExistance && idValue.equals("malformed") && graphNrNodes.equals("0") && graphStrictChecking && nodeDegree.equals("Many")) {
test5();
}else if(!idExistance && idValue.equals("") && graphNrNodes.equals("0") && graphStrictChecking && nodeDegree.equals("Many")) {
test6();
}else if(idExistance && idValue.equals("null") && graphNrNodes.equals("many") && graphStrictChecking && nodeDegree.equals("Many")) {
test7();
}else if(!idExistance && idValue.equals("correct") && graphNrNodes.equals("0") && graphStrictChecking && nodeDegree.equals("0")) {
test8();
}
}
public void test1() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test2() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test3() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test4() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test5() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test6() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test7() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
public void test8() {
SingleGraph single = new SingleGraph("single"); // strict checking will be set auto to true by the constructor.
String idValue = "nodeNew";
for (int i=0; i<10; i++) {
single.addNode("node"+i);
}
for (int i = 0; i < 4; i++) {
single.addEdge("Edge_"+i, "node1", "node"+(i+1));
}
exception.expect(ElementNotFoundException.class);
single.removeNode("nodeNew");
}
}