DataGenerator { public Collection<LObject<String>> generateGoldLabels( TroiaObjectCollection objects, double goldCoverage) { int goldCount = (int) (objects.size() * goldCoverage); Collection<LObject<String>> goldLabels = new ArrayList<LObject<String>>(); Iterator<String> objectsIterator = objects.iterator(); for (int i = 0; i < goldCount; i++) { String objectName; if (objectsIterator.hasNext()) { objectName = objectsIterator.next(); LObject<String> goldObject = new LObject<String>(objectName); goldObject.setGoldLabel(objects.getCategory(objectName)); goldLabels.add(goldObject); } else { break; } } return goldLabels; } private  DataGenerator(); TroiaObjectCollection generateTestObjects(int objectCount,
			Map<String, Double> categories); TroiaObjectCollection generateTestObjects(int objectCount,
			int categoryCount); TroiaObjectCollection generateTestObjects(int objectCount,
			Collection<String> categoryNames); Collection<String> generateCategoryNames(int categoryCount); ArtificialWorker generateArtificialWorker(String name,
			double quality, Collection<String> categories); ArtificialWorker generateArtificialWorker(String name,
			Collection<String> categories); Collection<ArtificialWorker> generateArtificialWorkers(
		int workerCount, Collection<String> categories, double minQuality,
		double maxQuality); Collection<AssignedLabel<String>> generateLabels(Collection<ArtificialWorker> workers, TroiaObjectCollection objects, int workersPerObject); Collection<LObject<String>> generateGoldLabels(
		TroiaObjectCollection objects, double goldCoverage); Collection<Map<String, Object>> computeArtificialWorkerQualities(
			Collection<String> categories,
			TroiaObjectCollection objects,
			Collection<ArtificialWorker> workers,
			Collection<AssignedLabel<String>> labels,
			Collection<LObject<String>> goldLabels); Data generateTestData(String requestId, int objectCount,
			int categoryCount, int workerCount, double minQuality,
			double maxQuality, double goldRatio, int workersPerObject); static DataGenerator getInstance(); final static double CONFUSION_VECTOR_SUM_EPSILON; }
@Test public void testGenerateGoldLabels() { final int objectsCount = 100; final int categoriesCount = 2; final double goldCoverage = 0.526; DataGenerator generator = DataGenerator.getInstance(); Collection<String> categories = generator.generateCategoryNames(categoriesCount); TroiaObjectCollection objects = generator.generateTestObjects(objectsCount, categories); Collection<LObject<String>> goldLabels = generator.generateGoldLabels(objects, goldCoverage); assertEquals(goldLabels.size(), (int)(objectsCount * goldCoverage)); }