org.testng.annotations.Test.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.testng.annotations.Test.<init>()方法的一些代码示例,展示了Test.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Test.<init>()方法的具体详情如下:
包路径:org.testng.annotations.Test
类名称:Test
方法名:<init>

Test.<init>介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Test
public void testGroupByNanArray()
{
  MaterializedResult actual = computeActual("SELECT a FROM (VALUES (ARRAY[nan(), 2e0, 3e0]), (ARRAY[nan(), 2e0, 3e0])) t(a) GROUP BY a");
  List<MaterializedRow> actualRows = actual.getMaterializedRows();
  assertEquals(actualRows.size(), 1);
  assertTrue(Double.isNaN(((List<Double>) actualRows.get(0).getField(0)).get(0)));
  assertEquals(((List<Double>) actualRows.get(0).getField(0)).get(1), 2.0);
  assertEquals(((List<Double>) actualRows.get(0).getField(0)).get(2), 3.0);
}

代码示例来源:origin: prestodb/presto

@Test
public void testTransactionsTable()
{
  List<MaterializedRow> result = computeActual("SELECT * FROM system.runtime.transactions").getMaterializedRows();
  assertTrue(result.size() >= 1); // At least one row for the current transaction.
}

代码示例来源:origin: spring-projects/spring-framework

@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyBeanInitialized() {
  assertInTransaction(false);
  assertTrue(beanInitialized,
      "This test instance should have been initialized due to InitializingBean semantics.");
}

代码示例来源:origin: prestodb/presto

@Test
public void testCreateSchema()
{
  assertEquals(metadata.listSchemaNames(SESSION), ImmutableList.of("default"));
  metadata.createSchema(SESSION, "test", ImmutableMap.of());
  assertEquals(metadata.listSchemaNames(SESSION), ImmutableList.of("default", "test"));
}

代码示例来源:origin: prestodb/presto

@Test
public void testTableSampleBernoulli()
{
  DescriptiveStatistics stats = new DescriptiveStatistics();
  int total = computeExpected("SELECT orderkey FROM orders", ImmutableList.of(BIGINT)).getMaterializedRows().size();
  for (int i = 0; i < 100; i++) {
    List<MaterializedRow> values = computeActual("SELECT orderkey FROM orders TABLESAMPLE BERNOULLI (50)").getMaterializedRows();
    assertEquals(values.size(), ImmutableSet.copyOf(values).size(), "TABLESAMPLE produced duplicate rows");
    stats.addValue(values.size() * 1.0 / total);
  }
  double mean = stats.getGeometricMean();
  assertTrue(mean > 0.45 && mean < 0.55, format("Expected mean sampling rate to be ~0.5, but was %s", mean));
}

代码示例来源:origin: prestodb/presto

@Test
public void testScheduleLocal()
{
  Split split = new Split(CONNECTOR_ID, TestingTransactionHandle.create(), new TestSplitLocal());
  Set<Split> splits = ImmutableSet.of(split);
  Map.Entry<Node, Split> assignment = Iterables.getOnlyElement(nodeSelector.computeAssignments(splits, ImmutableList.copyOf(taskMap.values())).getAssignments().entries());
  assertEquals(assignment.getKey().getHostAndPort(), split.getAddresses().get(0));
  assertEquals(assignment.getValue(), split);
}

代码示例来源:origin: prestodb/presto

@Test
public void testDoubleMapMultimap()
{
  Type mapType = mapType(VARCHAR, BIGINT);
  List<Double> expectedKeys = ImmutableList.of(1.0, 2.0, 3.0);
  List<Map<String, Long>> expectedValues = ImmutableList.of(ImmutableMap.of("a", 1L), ImmutableMap.of("b", 2L, "c", 3L, "d", 4L), ImmutableMap.of("a", 1L));
  testMultimapAgg(DOUBLE, expectedKeys, mapType, expectedValues);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void autowiringFromConfigClass() {
  assertNotNull(employee, "The employee should have been autowired.");
  assertEquals(employee.getName(), "John Smith");
  assertNotNull(pet, "The pet should have been autowired.");
  assertEquals(pet.getName(), "Fido");
}

代码示例来源:origin: prestodb/presto

@Test
public void testBloomFilterPredicateValuesNonExisting()
{
  BloomFilter bloomFilter = new BloomFilter(TEST_VALUES.size() * 10, 0.01);
  for (Map.Entry<Object, Type> testValue : TEST_VALUES.entrySet()) {
    boolean matched = checkInBloomFilter(bloomFilter, testValue.getKey(), testValue.getValue());
    assertFalse(matched, "type " + testValue.getKey().getClass());
  }
  // test unsupported type: can be supported by ORC but is not implemented yet
  assertTrue(checkInBloomFilter(bloomFilter, new Date(), DATE), "unsupported type DATE should always return true");
}

代码示例来源:origin: prestodb/presto

@Test
public void testAll()
{
  assertTrue(TupleDomain.all().isAll());
  assertEquals(TupleDomain.<ColumnHandle>all(),
      TupleDomain.withColumnDomains(ImmutableMap.of(
          A, Domain.all(BIGINT))));
  assertEquals(TupleDomain.<ColumnHandle>all(),
      TupleDomain.withColumnDomains(ImmutableMap.<ColumnHandle, Domain>of()));
}

代码示例来源:origin: prestodb/presto

@Test
public void testSvmRegressor()
{
  Model model = new SvmRegressor();
  model.train(getDataset());
  Slice serialized = ModelUtils.serialize(model);
  Model deserialized = ModelUtils.deserialize(serialized);
  assertNotNull(deserialized, "deserialization failed");
  assertTrue(deserialized instanceof SvmRegressor, "deserialized model is not a svm");
}

代码示例来源:origin: prestodb/presto

@Test
public void testGetUpdateCount()
    throws Exception
{
  try (Connection connection = createConnection()) {
    try (Statement statement = connection.createStatement()) {
      assertTrue(statement.execute("SELECT 123 x, 'foo' y"));
      assertEquals(statement.getUpdateCount(), -1);
      assertEquals(statement.getLargeUpdateCount(), -1);
    }
  }
}

代码示例来源:origin: prestodb/presto

@Test
public void testStatsExtraction()
    throws Exception
{
  try (PrestoResultSet rs = (PrestoResultSet) statement.executeQuery("SELECT 123 x, 456 x")) {
    assertNotNull(rs.getStats());
    assertTrue(rs.next());
    assertNotNull(rs.getStats());
    assertFalse(rs.next());
    assertNotNull(rs.getStats());
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyResourceAnnotationInjectedFields() {
  assertInTransaction(false);
  assertEquals(foo, "Foo", "The foo field should have been injected via @Resource.");
}

代码示例来源:origin: prestodb/presto

@Test
public void testGroupByNanRow()
{
  MaterializedResult actual = computeActual("SELECT a, b, c FROM (VALUES ROW(nan(), 1, 2), ROW(nan(), 1, 2)) t(a, b, c) GROUP BY 1, 2, 3");
  List<MaterializedRow> actualRows = actual.getMaterializedRows();
  assertEquals(actualRows.size(), 1);
  assertTrue(Double.isNaN((Double) actualRows.get(0).getField(0)));
  assertEquals(actualRows.get(0).getField(1), 1);
  assertEquals(actualRows.get(0).getField(2), 2);
}

代码示例来源:origin: prestodb/presto

@Test
public void testListUnknownSchema()
{
  assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("totally_invalid_database_name", "dual")));
  assertEquals(metadata.listTables(SESSION, "totally_invalid_database_name"), ImmutableList.of());
  assertEquals(metadata.listTableColumns(SESSION, new SchemaTablePrefix("totally_invalid_database_name", "dual")), ImmutableMap.of());
}

代码示例来源:origin: prestodb/presto

@Test
public void testStochasticPriorityQueue()
{
  assertTrue(populateAndExtract(new StochasticPriorityQueue<>()).size() == 3);
}

代码示例来源:origin: prestodb/presto

@Test
public void testGetCurrentNode()
{
  Node expected = activeNodes.get(0);
  NodeInfo nodeInfo = new NodeInfo(new NodeConfig()
      .setEnvironment("test")
      .setNodeId(expected.getNodeIdentifier()));
  DiscoveryNodeManager manager = new DiscoveryNodeManager(selector, nodeInfo, new NoOpFailureDetector(), expectedVersion, testHttpClient, internalCommunicationConfig);
  assertEquals(manager.getCurrentNode(), expected);
}

代码示例来源:origin: prestodb/presto

@Test
public void testArrayHistograms()
{
  ArrayType arrayType = new ArrayType(VARCHAR);
  MapType mapType = mapType(arrayType, BIGINT);
  InternalAggregationFunction aggregationFunction = getAggregation(mapType.getTypeSignature(), arrayType.getTypeSignature());
  assertAggregation(
      aggregationFunction,
      ImmutableMap.of(ImmutableList.of("a", "b", "c"), 1L, ImmutableList.of("d", "e", "f"), 1L, ImmutableList.of("c", "b", "a"), 1L),
      createStringArraysBlock(ImmutableList.of(ImmutableList.of("a", "b", "c"), ImmutableList.of("d", "e", "f"), ImmutableList.of("c", "b", "a"))));
}

代码示例来源:origin: spring-projects/spring-framework

@Test
@Transactional(propagation = Propagation.NOT_SUPPORTED)
void verifyAnnotationAutowiredFields() {
  assertInTransaction(false);
  assertNull(nonrequiredLong, "The nonrequiredLong field should NOT have been autowired.");
  assertNotNull(pet, "The pet field should have been autowired.");
  assertEquals(pet.getName(), "Fido", "pet's name.");
}

相关文章