use of org.testng.annotations.DataProvider in project jdk8u_jdk by JetBrains.
the class BaseRowSetTests method testBaseParameters.
/*
* DataProvider used to set parameters for basic types that are supported
*/
@DataProvider(name = "testBaseParameters")
private Object[][] testBaseParameters() throws SQLException {
Integer aInt = 1;
Long aLong = Long.MAX_VALUE;
Short aShort = Short.MIN_VALUE;
BigDecimal bd = BigDecimal.ONE;
Double aDouble = Double.MAX_VALUE;
Date aDate = Date.valueOf(LocalDate.now());
Time aTime = Time.valueOf(LocalTime.now());
Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now());
Calendar cal = Calendar.getInstance();
Boolean aBoolean = true;
Float aFloat = 1.5f;
Byte aByte = 1;
brs = new StubBaseRowSet();
brs.setInt(1, aInt);
brs.setString(2, query);
brs.setLong(3, aLong);
brs.setBoolean(4, aBoolean);
brs.setShort(5, aShort);
brs.setDouble(6, aDouble);
brs.setBigDecimal(7, bd);
brs.setFloat(8, aFloat);
brs.setByte(9, aByte);
brs.setDate(10, aDate);
brs.setTime(11, aTime);
brs.setTimestamp(12, aTimeStamp);
brs.setDate(13, aDate, cal);
brs.setTime(14, aTime, cal);
brs.setTimestamp(15, aTimeStamp);
brs.setObject(16, query);
brs.setObject(17, query, Types.CHAR);
brs.setObject(18, query, Types.CHAR, 0);
return new Object[][] { { 1, aInt }, { 2, query }, { 3, aLong }, { 4, aBoolean }, { 5, aShort }, { 6, aDouble }, { 7, bd }, { 8, aFloat }, { 9, aByte }, { 10, aDate }, { 11, aTime }, { 12, aTimeStamp }, { 13, aDate }, { 14, aTime }, { 15, aTimeStamp }, { 16, query }, { 17, query }, { 18, query } };
}
use of org.testng.annotations.DataProvider in project jdk8u_jdk by JetBrains.
the class TCKWeekFields method data_weekFields.
//-----------------------------------------------------------------------
@DataProvider(name = "weekFields")
Object[][] data_weekFields() {
Object[][] objects = new Object[49][];
int i = 0;
for (DayOfWeek firstDayOfWeek : DayOfWeek.values()) {
for (int minDays = 1; minDays <= 7; minDays++) {
objects[i++] = new Object[] { firstDayOfWeek, minDays };
}
}
return objects;
}
use of org.testng.annotations.DataProvider in project jdk8u_jdk by JetBrains.
the class JoinRowSetTests method createCachedRowSetsToUse.
/*
* DataProvider used to set parameters for basic types that are supported
*/
@DataProvider(name = "createCachedRowSetsToUse")
private Object[][] createCachedRowSetsToUse() throws SQLException {
CachedRowSet crs = rsf.createCachedRowSet();
initCoffeesMetaData(crs);
createCoffeesRows(crs);
// Make sure you are not on the insertRow
crs.moveToCurrentRow();
CachedRowSet crs1 = rsf.createCachedRowSet();
initSuppliersMetaData(crs1);
createSuppiersRows(crs1);
// Make sure you are not on the insertRow
crs1.moveToCurrentRow();
return new Object[][] { { crs, crs1 } };
}
use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class ReadFilterLibraryUnitTest method mateOnSameContigOrNoMappedMateTestData.
@DataProvider(name = "MateOnSameContigOrNoMappedMateTestData")
public Object[][] mateOnSameContigOrNoMappedMateTestData() {
final SAMFileHeader header = createHeaderWithReadGroups();
final GATKRead unpairedRead = simpleGoodRead(header);
unpairedRead.setIsPaired(false);
final GATKRead pairedReadWithUnmappedMate = simpleGoodRead(header);
pairedReadWithUnmappedMate.setIsPaired(true);
pairedReadWithUnmappedMate.setMateIsUnmapped();
final GATKRead pairedReadWithMappedMateDifferentContig = simpleGoodRead(header);
pairedReadWithMappedMateDifferentContig.setIsPaired(true);
pairedReadWithMappedMateDifferentContig.setMatePosition("2", 1);
pairedReadWithMappedMateDifferentContig.setPosition("1", 1);
final GATKRead pairedReadWithMappedMateSameContig = simpleGoodRead(header);
pairedReadWithMappedMateSameContig.setIsPaired(true);
pairedReadWithMappedMateSameContig.setMatePosition("1", 100);
pairedReadWithMappedMateSameContig.setPosition("1", 1);
final GATKRead unmappedReadWithMappedMate = simpleGoodRead(header);
unmappedReadWithMappedMate.setIsUnmapped();
unmappedReadWithMappedMate.setIsPaired(true);
unmappedReadWithMappedMate.setMatePosition("1", 100);
final GATKRead unmappedReadWithUnmappedMate = simpleGoodRead(header);
unmappedReadWithUnmappedMate.setIsUnmapped();
unmappedReadWithUnmappedMate.setIsPaired(true);
unmappedReadWithUnmappedMate.setMateIsUnmapped();
final GATKRead unmappedUnpairedRead = simpleGoodRead(header);
unmappedUnpairedRead.setIsUnmapped();
unmappedUnpairedRead.setIsPaired(false);
return new Object[][] { { unpairedRead, true }, { pairedReadWithUnmappedMate, true }, { pairedReadWithMappedMateDifferentContig, false }, { pairedReadWithMappedMateSameContig, true }, { unmappedReadWithMappedMate, false }, { unmappedReadWithUnmappedMate, true }, { unmappedUnpairedRead, true } };
}
use of org.testng.annotations.DataProvider in project gatk by broadinstitute.
the class ReadCountCollectionUnitTest method testArrangeTargets.
@Test(dataProvider = "targetArrangeData")
public void testArrangeTargets(final ReadCountCollectionInfo info, final List<String> newOrder) {
final List<Target> targetsNewOrder = newOrder.stream().map(Target::new).collect(Collectors.toList());
final ReadCountCollection subject = info.newInstance();
final ReadCountCollection result = subject.arrangeTargets(targetsNewOrder);
final List<Target> afterTargets = result.targets();
Assert.assertEquals(afterTargets.size(), targetsNewOrder.size());
Assert.assertFalse(afterTargets.stream().anyMatch(t -> !targetsNewOrder.contains(t)));
final RealMatrix beforeCounts = subject.counts();
final RealMatrix afterCounts = result.counts();
Assert.assertEquals(beforeCounts.getColumnDimension(), afterCounts.getColumnDimension());
Assert.assertEquals(afterCounts.getRowDimension(), targetsNewOrder.size());
final int[] beforeIndexes = new int[targetsNewOrder.size()];
final int[] afterIndexes = new int[targetsNewOrder.size()];
int nextIdx = 0;
for (final Target target : targetsNewOrder) {
final int beforeIndex = subject.targets().indexOf(target);
final int afterIndex = result.targets().indexOf(target);
beforeIndexes[nextIdx] = beforeIndex;
afterIndexes[nextIdx++] = afterIndex;
}
// check that the counts are exactly the same.
for (int i = 0; i < beforeIndexes.length; i++) {
final double[] before = beforeCounts.getRow(beforeIndexes[i]);
final double[] after = afterCounts.getRow(afterIndexes[i]);
Assert.assertEquals(before, after);
}
}
Aggregations