Skip to content

Commit

Permalink
fixed the broken test for PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesemery committed Sep 11, 2023
1 parent cf5670f commit 62abde0
Showing 1 changed file with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,26 +357,30 @@ private Iterator<Object[]> provideForTestNewVersionRegex() {
final ArrayList<Object[]> testArgs = new ArrayList<>();

final List<Object[]> baseArgs = createBaseTestVersionData();
final String[] refVersions = new String[] { "hg19", "hg38"};

for ( final Object[] args : baseArgs ) {
for ( int whitespace = 0; whitespace < 2; ++whitespace ) {
for ( int decoratorCount = 0; decoratorCount < 10; ++decoratorCount ) {

// Some sanity checks here for proper version numbers:
if (((Integer)args[0]) < 0 || ((Integer)args[1]) < 0){
continue;
for ( int refidx = 0; refidx < refVersions.length; ++refidx ) {

// Some sanity checks here for proper version numbers:
if (((Integer) args[0]) < 0 || ((Integer) args[1]) < 0) {
continue;
}

final String whitespaceString = whitespace != 0 ? "\t \t \t " : " ";
final String decoratorString = decoratorCount != 0 ? RandomStringUtils.randomAlphanumeric(decoratorCount) : "";

testArgs.add(
new Object[]{
args[0], args[1], args[2],
refVersions[refidx],
decoratorString,
whitespaceString
}
);
}

final String whitespaceString = whitespace != 0 ? "\t \t \t " : " ";
final String decoratorString = decoratorCount !=0 ? RandomStringUtils.randomAlphanumeric(decoratorCount) : "";

testArgs.add(
new Object[] {
args[0],args[1],args[2],
decoratorString,
whitespaceString
}
);
}
}
}
Expand Down Expand Up @@ -468,18 +472,19 @@ public void testGetDataSourceMinVersionString() {
@Test(dataProvider = "provideForTestNewVersionRegex")
public void testNewVersionRegex(final Integer major,
final Integer minor,
final String reference,
final LocalDate releaseDate,
final String reference,
final String decorator,
final String leadingWhitespace ) {

// Construct the string:
final String versionString = String.format(
"%s%s%d.%d.%4d%02d%02d%s",
"%s%s%d.%d.%s.%4d%02d%02d%s",
DataSourceUtils.MANIFEST_VERSION_LINE_START,
leadingWhitespace,
major,
minor,
reference,
releaseDate.getYear(),
releaseDate.getMonthValue(),
releaseDate.getDayOfMonth(),
Expand All @@ -492,13 +497,15 @@ public void testNewVersionRegex(final Integer major,

final Integer versionMajor = Integer.valueOf(matcher.group(1));
final Integer versionMinor = Integer.valueOf(matcher.group(2));
final Integer versionYear = Integer.valueOf(matcher.group(3));
final Integer versionMonth = Integer.valueOf(matcher.group(4));
final Integer versionDay = Integer.valueOf(matcher.group(5));
final String versionDecorator = matcher.group(6);
final Integer versionRef = Integer.valueOf(matcher.group(3));
final Integer versionYear = Integer.valueOf(matcher.group(4));
final Integer versionMonth = Integer.valueOf(matcher.group(5));
final Integer versionDay = Integer.valueOf(matcher.group(6));
final String versionDecorator = matcher.group(7);

Assert.assertEquals( versionMajor, major );
Assert.assertEquals( versionMinor, minor );
Assert.assertEquals( "hg"+versionRef, reference );
Assert.assertEquals( versionYear.intValue(), releaseDate.getYear() );
Assert.assertEquals( versionMonth.intValue(), releaseDate.getMonthValue() );
Assert.assertEquals( versionDay.intValue(), releaseDate.getDayOfMonth() );
Expand Down

0 comments on commit 62abde0

Please sign in to comment.