Search in sources :

Example 76 with DataProvider

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 } };
}
Also used : Calendar(java.util.Calendar) Time(java.sql.Time) LocalDateTime(java.time.LocalDateTime) LocalTime(java.time.LocalTime) Timestamp(java.sql.Timestamp) BigDecimal(java.math.BigDecimal) Date(java.sql.Date) LocalDate(java.time.LocalDate) StubBaseRowSet(util.StubBaseRowSet) DataProvider(org.testng.annotations.DataProvider)

Example 77 with DataProvider

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;
}
Also used : DayOfWeek(java.time.DayOfWeek) DataProvider(org.testng.annotations.DataProvider)

Example 78 with DataProvider

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 } };
}
Also used : CachedRowSet(javax.sql.rowset.CachedRowSet) DataProvider(org.testng.annotations.DataProvider)

Example 79 with DataProvider

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 } };
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) DataProvider(org.testng.annotations.DataProvider)

Example 80 with DataProvider

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);
    }
}
Also used : Array2DRowRealMatrix(org.apache.commons.math3.linear.Array2DRowRealMatrix) java.util(java.util) DataProvider(org.testng.annotations.DataProvider) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) IOException(java.io.IOException) TestUtil(htsjdk.samtools.util.TestUtil) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) ArrayAsserts(org.testng.internal.junit.ArrayAsserts) Collectors(java.util.stream.Collectors) Assert(org.testng.Assert) Utils(org.broadinstitute.hellbender.utils.Utils) RealMatrix(org.apache.commons.math3.linear.RealMatrix) Array2DRowRealMatrix(org.apache.commons.math3.linear.Array2DRowRealMatrix) RealMatrix(org.apache.commons.math3.linear.RealMatrix) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

DataProvider (org.testng.annotations.DataProvider)391 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)99 ArrayList (java.util.ArrayList)93 Test (org.testng.annotations.Test)85 File (java.io.File)74 List (java.util.List)72 Assert (org.testng.Assert)67 URIDetails (com.linkedin.restli.internal.testutils.URIDetails)65 Collectors (java.util.stream.Collectors)61 HashMap (java.util.HashMap)57 IntStream (java.util.stream.IntStream)54 Random (java.util.Random)50 RealMatrix (org.apache.commons.math3.linear.RealMatrix)44 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)41 IOException (java.io.IOException)39 ByteString (com.linkedin.data.ByteString)37 Array2DRowRealMatrix (org.apache.commons.math3.linear.Array2DRowRealMatrix)34 Stream (java.util.stream.Stream)31 DoubleStream (java.util.stream.DoubleStream)29 HashSet (java.util.HashSet)28