ExperimentDesignParser { static String extractMatchingContent(String string, Pattern pattern) { Matcher matcher = pattern.matcher(string); if (matcher.matches()) { return matcher.group(1); } return null; } @Inject  ExperimentDesignParser(DataFileHub dataFileHub, SdrfParser sdrfParser); ExperimentDesign parse(String experimentAccession);  }
@Test public void testExtractGroup1Match() { String matchingString = extractMatchingContent("Assay Bello", SAMPLE_COLUMN_HEADER_PATTERN); assertThat(matchingString, is(nullValue())); matchingString = extractMatchingContent("Assay Bello[assai]", SAMPLE_COLUMN_HEADER_PATTERN); assertThat(matchingString, is(nullValue())); matchingString = extractMatchingContent("Sample Characteristic[bello assai] ", SAMPLE_COLUMN_HEADER_PATTERN); assertThat(matchingString, is("bello assai")); matchingString = extractMatchingContent("Sample Characteristic[bello assai]", SAMPLE_COLUMN_HEADER_PATTERN); assertThat(matchingString, is("bello assai")); matchingString = extractMatchingContent("Sample Characteristic[bello assai]", SAMPLE_COLUMN_HEADER_PATTERN); assertThat(matchingString, is(nullValue())); }