• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Sets类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.testng.collections.Sets的典型用法代码示例。如果您正苦于以下问题:Java Sets类的具体用法?Java Sets怎么用?Java Sets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Sets类属于org.testng.collections包,在下文中一共展示了Sets类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testCollectionContainingObjectAnnotatedWithCerealClass

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void testCollectionContainingObjectAnnotatedWithCerealClass() throws CerealException {
    StringWrapperContainer container = new StringWrapperContainer();
    container.setWrappers(Arrays.asList(new StringWrapper("kp"), new StringWrapper(null)));
    Map<String, Set<StringWrapper>> wrapperMap = new HashMap<String, Set<StringWrapper>>();
    wrapperMap.put("1", Sets.newHashSet(Arrays.asList(new StringWrapper("mp"))));
    Map<String, Set<String>> wrapperMap2 = new HashMap<String, Set<String>>();
    wrapperMap2.put("y", Sets.newHashSet(Arrays.asList("x")));
    container.setWrapperMap(wrapperMap);
    container.setWrapperMapNoSubtype(wrapperMap2);
    
    JsonCerealEngine engine = new JsonCerealEngine();
    CerealSettings settings = new CerealSettings();
    settings.setIncludeClassName(false);
    engine.setSettings(settings);
    String cereal = engine.writeToString(container);
    StringWrapperContainer decereal = engine.readFromString(cereal, StringWrapperContainer.class);
    Collection<StringWrapper> wrappers = new ArrayList<StringWrapper>(decereal.getWrappers());
    wrappers.addAll(decereal.getWrapperMap().get("1"));
    Assert.assertEquals(wrappers.size(), 3);
    for (Object obj : wrappers) {
        Assert.assertEquals(obj.getClass(), StringWrapper.class);
    }
    Assert.assertEquals(decereal, container);
}
 
开发者ID:Comcast,项目名称:cereal,代码行数:26,代码来源:CollectionTest.java


示例2: getDataProviders

import org.testng.collections.Sets; //导入依赖的package包/类
/** A Method that returns all the Methods that are annotated with @DataProvider
 * in a given package. Should be moved to htsjdk and used from there
 *
 * @param packageName the package under which to look for classes and methods
 * @return an iterator to collection of Object[]'s consisting of {Method method, Class clazz} pair.
 * where method has the @DataProviderAnnotation and is a member of clazz.
 */
public static Iterator<Object[]> getDataProviders(final String packageName) {
    List<Object[]> data = new ArrayList<>();
    final ClassFinder classFinder = new ClassFinder();
    classFinder.find(packageName, Object.class);

    for (final Class<?> testClass : classFinder.getClasses()) {
        if (Modifier.isAbstract(testClass.getModifiers()) || Modifier.isInterface(testClass.getModifiers()))
            continue;
        Set<Method> methodSet = Sets.newHashSet();
        methodSet.addAll(Arrays.asList(testClass.getDeclaredMethods()));
        methodSet.addAll(Arrays.asList(testClass.getMethods()));

        for (final Method method : methodSet) {
            if (method.isAnnotationPresent(DataProvider.class)) {
                data.add(new Object[]{method, testClass});
            }
        }
    }

    return data.iterator();
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:29,代码来源:TestNGUtil.java


示例3: test500ScriptingUsers

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void test500ScriptingUsers() throws Exception {
	final String TEST_NAME = "test500ScriptingUsers";
	TestUtil.displayTestTile(this, TEST_NAME);

	// GIVEN
	Task task = createTask(DOT_CLASS + TEST_NAME);
	OperationResult result = task.getResult();
	PrismProperty<ScriptingExpressionType> expression = parseAnyData(SCRIPTING_USERS_FILE);

	// WHEN
	ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);

	// THEN
       dumpOutput(output, result);
       result.computeStatus();
	TestUtil.assertSuccess(result);
	PipelineData data = output.getFinalOutput();
	assertEquals("Unexpected # of items in output", 5, data.getData().size());
	Set<String> realOids = new HashSet<>();
       for (PipelineItem item : data.getData()) {
           PrismValue value = item.getValue();
		PrismObject<UserType> user = ((PrismObjectValue<UserType>) value).asPrismObject();
		assertEquals("Description not set", "Test", user.asObjectable().getDescription());
		realOids.add(user.getOid());
		assertSuccess(item.getResult());
	}
	assertEquals("Unexpected OIDs in output",
			Sets.newHashSet(Arrays.asList(USER_ADMINISTRATOR_OID, USER_JACK_OID, USER_BARBOSSA_OID, USER_GUYBRUSH_OID, USER_ELAINE_OID)),
			realOids);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:32,代码来源:TestScriptingBasic.java


示例4: uniqueMethodList

import org.testng.collections.Sets; //导入依赖的package包/类
/**
 * Extracts the unique list of <code>ITestNGMethod</code>s.
 */
public static List<ITestNGMethod> uniqueMethodList(Collection<List<ITestNGMethod>> methods) {
  Set<ITestNGMethod> resultSet = Sets.newHashSet();

  for (List<ITestNGMethod> l : methods) {
    resultSet.addAll(l);
  }

  return Lists.newArrayList(resultSet);
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:13,代码来源:MethodHelper.java


示例5: extractTrades

import org.testng.collections.Sets; //导入依赖的package包/类
private Set<ManageableTrade> extractTrades(PositionMaster positionMaster) {
  Set<ManageableTrade> tradeSet = Sets.newHashSet();
  for (ManageablePosition p : positionMaster.search(new PositionSearchRequest()).getPositions()) {
    tradeSet.addAll(p.getTrades());
  }
  return tradeSet;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:XmlPortfolioLoaderToolTest.java


示例6: test500ScriptingUsers

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void test500ScriptingUsers() throws Exception {
	final String TEST_NAME = "test500ScriptingUsers";
	TestUtil.displayTestTitle(this, TEST_NAME);

	// GIVEN
	Task task = createTask(DOT_CLASS + TEST_NAME);
	OperationResult result = task.getResult();
	PrismProperty<ScriptingExpressionType> expression = parseAnyData(SCRIPTING_USERS_FILE);

	// WHEN
	ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result);

	// THEN
       dumpOutput(output, result);
       result.computeStatus();
	TestUtil.assertSuccess(result);
	PipelineData data = output.getFinalOutput();
	assertEquals("Unexpected # of items in output", 5, data.getData().size());
	Set<String> realOids = new HashSet<>();
       for (PipelineItem item : data.getData()) {
           PrismValue value = item.getValue();
		PrismObject<UserType> user = ((PrismObjectValue<UserType>) value).asPrismObject();
		assertEquals("Description not set", "Test", user.asObjectable().getDescription());
		realOids.add(user.getOid());
		assertSuccess(item.getResult());
	}
	assertEquals("Unexpected OIDs in output",
			Sets.newHashSet(Arrays.asList(USER_ADMINISTRATOR_OID, USER_JACK_OID, USER_BARBOSSA_OID, USER_GUYBRUSH_OID, USER_ELAINE_OID)),
			realOids);
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:32,代码来源:TestScriptingBasic.java


示例7: basicTest

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void basicTest() throws IOException {
    final Set<String> headersOfInterest = Sets.newHashSet(Arrays.asList("name", "learning_SAMPLE_0"));
    final List<SimpleAnnotatedGenomicRegion> simpleAnnotatedGenomicRegions =
            SimpleAnnotatedGenomicRegion.readAnnotatedRegions(TEST_FILE, headersOfInterest);

    Assert.assertEquals(simpleAnnotatedGenomicRegions.size(), 15);
    Assert.assertTrue(simpleAnnotatedGenomicRegions.stream()
            .mapToInt(s -> s.getAnnotations().entrySet().size())
            .allMatch(i -> i == headersOfInterest.size()));
    Assert.assertTrue(simpleAnnotatedGenomicRegions.stream().allMatch(s -> s.getAnnotations().keySet().containsAll(headersOfInterest)));

    // Grab the first 15 and test values
    List<SimpleAnnotatedGenomicRegion> gtRegions = Arrays.asList(
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 30365, 30503), ImmutableSortedMap.of("name", "target_1_None", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 69088, 70010), ImmutableSortedMap.of("name", "target_2_None", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 367656, 368599), ImmutableSortedMap.of("name", "target_3_None", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 621093, 622036), ImmutableSortedMap.of("name", "target_4_None", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 861319, 861395), ImmutableSortedMap.of("name", "target_5_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 865532, 865718), ImmutableSortedMap.of("name", "target_6_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 866416, 866471), ImmutableSortedMap.of("name", "target_7_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 871149, 871278), ImmutableSortedMap.of("name", "target_8_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 874417, 874511), ImmutableSortedMap.of("name", "target_9_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 874652, 874842), ImmutableSortedMap.of("name", "target_10_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 876521, 876688), ImmutableSortedMap.of("name", "target_11_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 877513, 877633), ImmutableSortedMap.of("name", "target_12_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 877787, 877870), ImmutableSortedMap.of("name", "target_13_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 877936, 878440), ImmutableSortedMap.of("name", "target_14_SAMD11", "learning_SAMPLE_0", "2")),
            new SimpleAnnotatedGenomicRegion(new SimpleInterval("1", 878630, 878759), ImmutableSortedMap.of("name", "target_15_SAMD11", "learning_SAMPLE_0", "2"))
    );

    Assert.assertEquals(simpleAnnotatedGenomicRegions.subList(0, gtRegions.size()), gtRegions);

}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:35,代码来源:SimpleAnnotatedGenomicRegionUnitTest.java


示例8: writeAllToBuffer

import org.testng.collections.Sets; //导入依赖的package包/类
private void writeAllToBuffer(XMLStringBuffer xmlBuffer, ISuiteResult suiteResult) {
  xmlBuffer.push(XMLReporterConfig.TAG_TEST, getSuiteResultAttributes(suiteResult));
  Set<ITestResult> testResults = Sets.newHashSet();
  ITestContext testContext = suiteResult.getTestContext();
  addAllTestResults(testResults, testContext.getPassedTests());
  addAllTestResults(testResults, testContext.getFailedTests());
  addAllTestResults(testResults, testContext.getSkippedTests());
  addAllTestResults(testResults, testContext.getPassedConfigurations());
  addAllTestResults(testResults, testContext.getSkippedConfigurations());
  addAllTestResults(testResults, testContext.getFailedConfigurations());
  addAllTestResults(testResults, testContext.getFailedButWithinSuccessPercentageTests());
  addTestResults(xmlBuffer, testResults);
  xmlBuffer.pop();
}
 
开发者ID:bigtester,项目名称:automation-test-engine,代码行数:15,代码来源:ATEXMLSuiteResultWriter.java


示例9: testSelectQueriesWithAllSelectionPolicies

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void testSelectQueriesWithAllSelectionPolicies(){

  QueryContext q1 = mock(QueryContext.class);
  QueryContext q2 = mock(QueryContext.class);
  QueryContext q3 = mock(QueryContext.class);

  /* eligibleQueriesSet1, eligibleQueriesSet2, eligibleQueriesSet3 have q1 in common */
  Set<QueryContext> eligibleQueriesSet1 = Sets.newHashSet(Arrays.asList(q1, q2));
  Set<QueryContext> eligibleQueriesSet2 = Sets.newHashSet(Arrays.asList(q1, q3));
  Set<QueryContext> eligibleQueriesSet3 = Sets.newHashSet(Arrays.asList(q1, q2));

  FinishedLensQuery mockFinishedQuery = mock(FinishedLensQuery.class);
  EstimatedImmutableQueryCollection mockWaitingQueries = mock(EstimatedImmutableQueryCollection.class);
  WaitingQueriesSelectionPolicy policy1 = mock(WaitingQueriesSelectionPolicy.class);
  WaitingQueriesSelectionPolicy policy2 = mock(WaitingQueriesSelectionPolicy.class);
  WaitingQueriesSelectionPolicy driverSelectionPolicy = mock(WaitingQueriesSelectionPolicy.class);

  when(mockFinishedQuery.getDriverSelectionPolicies()).thenReturn(ImmutableSet.of(driverSelectionPolicy));

  /* selection policy1 will return eligibleQueriesSet1 */
  when(policy1.selectQueries(mockFinishedQuery, mockWaitingQueries)).thenReturn(eligibleQueriesSet1);

  /* selection policy2 will return eligibleQueriesSet2 */
  when(policy2.selectQueries(mockFinishedQuery, mockWaitingQueries)).thenReturn(eligibleQueriesSet2);

  /* driver selection policy will return eligibleQueriesSet3 */
  when(driverSelectionPolicy.selectQueries(mockFinishedQuery, mockWaitingQueries)).thenReturn(eligibleQueriesSet3);

  WaitingQueriesSelector selector = new UnioningWaitingQueriesSelector(ImmutableSet.of(policy1, policy2));

  /* selector should return only eligibleQuery1, as this is the only common eligible waiting query returned
  * by both selection policies */
  Set<QueryContext> actualEligibleQueries = selector.selectQueries(mockFinishedQuery, mockWaitingQueries);
  Set<QueryContext> expectedEligibleQueries = Sets.newHashSet(Arrays.asList(q1, q2, q3));

  assertEquals(actualEligibleQueries, expectedEligibleQueries);
}
 
开发者ID:apache,项目名称:lens,代码行数:39,代码来源:UnioningWaitingQueriesSelectorTest.java


示例10: loadUserByUsername_SuperUser

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void loadUserByUsername_SuperUser()
{
	UserDetails user = userDetailsService.loadUserByUsername("admin");
	Set<String> authorities = Sets.newHashSet(Collections2.transform(user.getAuthorities(),
			(Function<GrantedAuthority, String>) GrantedAuthority::getAuthority));
	assertTrue(authorities.contains(SecurityUtils.AUTHORITY_SU));
	assertEquals(authorities.size(), 1);
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:10,代码来源:UserDetailsServiceTest.java


示例11: loadUserByUsername_NonSuperUser

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void loadUserByUsername_NonSuperUser()
{
	UserDetails user = userDetailsService.loadUserByUsername("user");
	Set<String> authorities = Sets.newHashSet(Collections2.transform(user.getAuthorities(),
			(Function<GrantedAuthority, String>) GrantedAuthority::getAuthority));
	assertEquals(authorities.size(), 0);
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:9,代码来源:UserDetailsServiceTest.java


示例12: initListeners

import org.testng.collections.Sets; //导入依赖的package包/类
private void initListeners() {
  //
  // Find all the listener factories and collect all the listeners requested in a
  // @Listeners annotation.
  //
  Set<Class<? extends ITestNGListener>> listenerClasses = Sets.newHashSet();
  Class<? extends ITestNGListenerFactory> listenerFactoryClass = null;

  for (IClass cls : getTestClasses()) {
    Class<?> realClass = cls.getRealClass();
    ListenerHolder listenerHolder = findAllListeners(realClass);
    if (listenerFactoryClass == null) {
      listenerFactoryClass = listenerHolder.listenerFactoryClass;
    }
    listenerClasses.addAll(listenerHolder.listenerClasses);
  }

  //
  // Now we have all the listeners collected from @Listeners and at most one
  // listener factory collected from a class implementing ITestNGListenerFactory.
  // Instantiate all the requested listeners.
  //
  ITestNGListenerFactory listenerFactory = null;

  // If we found a test listener factory, instantiate it.
  try {
    if (m_testClassFinder != null) {
      IClass ic = m_testClassFinder.getIClass(listenerFactoryClass);
      if (ic != null) {
        listenerFactory = (ITestNGListenerFactory) ic.getInstances(false)[0];
      }
    }
    if (listenerFactory == null) {
      listenerFactory = listenerFactoryClass != null ? listenerFactoryClass.newInstance() : null;
    }
  }
  catch(Exception ex) {
    throw new TestNGException("Couldn't instantiate the ITestNGListenerFactory: "
        + ex);
  }

  // Instantiate all the listeners
  for (Class<? extends ITestNGListener> c : listenerClasses) {
    if (IClassListener.class.isAssignableFrom(c) && m_classListeners.containsKey(c)) {
        continue;
    }
    ITestNGListener listener = listenerFactory != null ? listenerFactory.createListener(c) : null;
    if (listener == null) {
      listener = ClassHelper.newInstance(c);
    }

    addListener(listener);
  }
}
 
开发者ID:qmetry,项目名称:qaf,代码行数:55,代码来源:TestRunner.java


示例13: testPrepareAllSelectionPoliciesWithNoDriverSelectionPolicy

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void testPrepareAllSelectionPoliciesWithNoDriverSelectionPolicy() {

  WaitingQueriesSelectionPolicy p1 = mock(WaitingQueriesSelectionPolicy.class);
  WaitingQueriesSelectionPolicy p2 = mock(WaitingQueriesSelectionPolicy.class);

  final ImmutableSet<WaitingQueriesSelectionPolicy> emptySet = ImmutableSet.copyOf(
    Sets.<WaitingQueriesSelectionPolicy>newHashSet());

  FinishedLensQuery mockFinishedQuery = mock(FinishedLensQuery.class);
  when(mockFinishedQuery.getDriverSelectionPolicies()).thenReturn(emptySet);

  UnioningWaitingQueriesSelector selector = new UnioningWaitingQueriesSelector(ImmutableSet.of(p1, p2));

  assertEquals(selector.prepareAllSelectionPolicies(mockFinishedQuery), ImmutableSet.of(p1, p2));
}
 
开发者ID:apache,项目名称:lens,代码行数:17,代码来源:UnioningWaitingQueriesSelectorTest.java


示例14: testSelectQueriesWithNoSelectionPolicies

import org.testng.collections.Sets; //导入依赖的package包/类
@Test
public void testSelectQueriesWithNoSelectionPolicies(){

  FinishedLensQuery mockFinishedQuery = mock(FinishedLensQuery.class);
  EstimatedImmutableQueryCollection mockWaitingQueries = mock(EstimatedImmutableQueryCollection.class);
  Set<WaitingQueriesSelectionPolicy> emptySetOfPolicies = Sets.newHashSet();

  when(mockFinishedQuery.getDriverSelectionPolicies()).thenReturn(ImmutableSet.copyOf(emptySetOfPolicies));

  WaitingQueriesSelector selector = new UnioningWaitingQueriesSelector(ImmutableSet.copyOf(emptySetOfPolicies));

  /* selector should return an empty set as no selection policy is available */
  Set<QueryContext> actualEligibleQueries = selector.selectQueries(mockFinishedQuery, mockWaitingQueries);

  assertTrue(actualEligibleQueries.isEmpty());
}
 
开发者ID:apache,项目名称:lens,代码行数:17,代码来源:UnioningWaitingQueriesSelectorTest.java



注:本文中的org.testng.collections.Sets类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Service类代码示例发布时间:2022-05-21
下一篇:
Java Processor类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap