@@ -214,7 +214,7 @@ else if (reader.getLineNumber() == 1 && totalReads == 0 && !f.getName().contains
214214 sampleId = _sampleNameToIdMap .get (sampleName );
215215 }
216216 String name = (_outputPrefix == null ? "Reads" : _outputPrefix ) + "-R" + pairNumber + "-" + (sampleIdx == 0 ? "Control" : sampleId ) + ".fastq.gz" ;
217- File newFile = new File (targetDir , name );
217+ File newFile = FileUtil . appendName (targetDir , name );
218218
219219 if (!f .equals (newFile ))
220220 {
@@ -408,9 +408,7 @@ public void testHeaders() throws PipelineJobException, IOException
408408 {
409409 Module module = ModuleLoader .getInstance ().getModule ("genotyping" );
410410 File newHeaderPath = JunitUtil .getSampleData (module , "genotyping/illumina_newHeader" );
411- String newHeaderSampledataLoc = newHeaderPath .toString ();
412411 File oldHeaderPath = JunitUtil .getSampleData (module , "genotyping" );
413- String oldHeaderSampledataLoc = oldHeaderPath .toString ();
414412 final List <String > filenamesOldHeader = Arrays .asList (
415413 "IlluminaSamples-R1-4892.fastq.gz" ,
416414 "IlluminaSamples-R1-4893.fastq.gz" ,
@@ -472,8 +470,7 @@ public void testHeaders() throws PipelineJobException, IOException
472470 "IlluminaSamplesNewHeader-R2-4905.fastq.gz"
473471 );
474472
475- final Pair [] pairs =
476- {
473+ final var pairs = List .of (
477474 new Pair <>(4892 , 1 ),
478475 new Pair <>(4893 , 1 ),
479476 new Pair <>(4894 , 1 ),
@@ -501,11 +498,10 @@ public void testHeaders() throws PipelineJobException, IOException
501498 new Pair <>(4902 , 2 ),
502499 new Pair <>(4903 , 2 ),
503500 new Pair <>(4904 , 2 ),
504- new Pair <>(4905 , 2 )
505- };
501+ new Pair <>(4905 , 2 ));
506502
507503 int i = 0 ;
508- int numOfPairs = pairs .length ;
504+ int numOfPairs = pairs .size () ;
509505 Set <Pair <Integer , Integer >> expectedOutputs = new HashSet <>();
510506 Map <Integer , Integer > sampleIndexToIdMap = new IntHashMap <>();
511507 sampleIndexToIdMap .put (0 , 0 );
@@ -516,15 +512,15 @@ public void testHeaders() throws PipelineJobException, IOException
516512
517513 for (String fn : filenamesOldHeader )
518514 {
519- File target = new File (_testRoot , fn );
520- FileUtils .copyFile (new File ( oldHeaderSampledataLoc , fn ), target );
521- expectedOutputs .add (( Pair < Integer , Integer >) pairs [ i ] );
515+ File target = FileUtil . appendName (_testRoot , fn );
516+ FileUtils .copyFile (FileUtil . appendName ( oldHeaderPath , fn ), target );
517+ expectedOutputs .add (pairs . get ( i ) );
522518 oldHeaderFiles .add (target );
523519
524520 if (i < (numOfPairs / 2 ))
525521 {
526- sampleIndexToIdMap .put (i + 1 , ( Integer ) pairs [ i ] .getKey ());
527- sampleIdToIndexMap .put (( Integer ) pairs [ i ] .getKey (), i + 1 );
522+ sampleIndexToIdMap .put (i + 1 , pairs . get ( i ) .getKey ());
523+ sampleIdToIndexMap .put (pairs . get ( i ) .getKey (), i + 1 );
528524 }
529525 i ++;
530526 }
@@ -537,29 +533,15 @@ public void testHeaders() throws PipelineJobException, IOException
537533
538534 for (String fn : filenamesNewHeader )
539535 {
540- File target = new File (_testRoot , fn );
541- FileUtils .copyFile (new File ( newHeaderSampledataLoc , fn ), target );
536+ File target = FileUtil . appendName (_testRoot , fn );
537+ FileUtils .copyFile (FileUtil . appendName ( newHeaderPath , fn ), target );
542538 newHeaderFiles .add (target );
543539 }
544540
545541 parser = new IlluminaFastqParser (null , sampleIndexToIdMap , sampleIdToIndexMap , Collections .emptyMap (), LogManager .getLogger (HeaderTestCase .class ), newHeaderFiles );
546542 outputs = parser .parseFastqFiles (null );
547543 Assert .assertEquals ("Outputs from parseFastqFiles with new headers were not as expected." , expectedOutputs , outputs .keySet ());
548544 }
549-
550- // @After // TODO: Disabling to debug gradle failure on TeamCity
551- public void cleanup () throws IOException
552- {
553- if (container != null )
554- {
555- ContainerManager .delete (container , TestContext .get ().getUser ());
556- }
557-
558- if (_testRoot != null )
559- {
560- FileUtils .deleteDirectory (_testRoot );
561- }
562- }
563545 }
564546}
565547
0 commit comments