Evaluation_ImplBase { public STATS_TYPE trainAndTest(List<ITEM_TYPE> trainItems, List<ITEM_TYPE> testItems) throws Exception { File subDirectory = new File(this.baseDirectory, "train_and_test"); subDirectory.mkdirs(); this.train(this.getCollectionReader(trainItems), subDirectory); return this.test(this.getCollectionReader(testItems), subDirectory); } Evaluation_ImplBase(File baseDirectory); STATS_TYPE trainAndTest(List<ITEM_TYPE> trainItems, List<ITEM_TYPE> testItems); List<STATS_TYPE> crossValidation(List<ITEM_TYPE> items, int nFolds);  }
@Test public void testTrainAndTest() throws Exception { TestableEvaluation evaluation = new TestableEvaluation(this.outputDirectory); List<String> trainItems = Arrays.asList("a", "b", "c"); List<String> testItems = Arrays.asList("d", "e", "f"); evaluation.trainAndTest(trainItems, testItems); Assert.assertEquals(1, evaluation.trainDirectories.size()); Assert.assertEquals(1, evaluation.testDirectories.size()); Assert.assertEquals(1, evaluation.trainDirectoryItems.size()); Assert.assertEquals(1, evaluation.testDirectoryItems.size()); Assert.assertEquals(Collections.singletonList(trainItems), evaluation.trainDirectoryItems); Assert.assertEquals(Collections.singletonList(testItems), evaluation.testDirectoryItems); for (File dir : evaluation.trainDirectories) { Assert.assertTrue(dir.getPath().startsWith(this.outputDirectory.getPath())); } for (File dir : evaluation.testDirectories) { Assert.assertTrue(dir.getPath().startsWith(this.outputDirectory.getPath())); } }