CategoryPartitionConstructorSingleGraph2.java

package org.graphstream.graph.implementations;

import static org.junit.Assert.*;

import java.util.Random;

import org.databene.benerator.anno.Source;
import org.databene.feed4junit.Feeder;
import org.graphstream.graph.implementations.SingleGraph;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(Feeder.class)
public class CategoryPartitionConstructorSingleGraph2 {

	@Test
	@Source("csvFiles/constructor2.csv")
	public void mainTest(String idV, String strictChecking, String autoCreate) {
		boolean strtCheck = true;
		boolean auto = false;

		//set strictChecking
		if(strictChecking.equals("false")){
			strtCheck = true;
		}
		//set autoCreate
		if(autoCreate.equals("true")){
			auto = true;
		}
		//Generate id
		String id = null;
		Random random = new Random();
		if(idV.equals("valid")){
			char[] chars = "abcdefghijklmnopqrstuvwxyz1234567890".toCharArray();
			StringBuilder sb = new StringBuilder();
			int max = random.nextInt(10);
			for (int i = 0; i < max; i++) {
			    char c = chars[random.nextInt(chars.length)];
			    sb.append(c);
			}
			id = sb.toString();
		}
		
		SingleGraph graph = new SingleGraph(id, strtCheck, auto);
		
		assertNotNull(graph);
		
	}
}