当前位置: 首页>>代码示例>>Java>>正文


Java CommonsTestHelper.testInParallel方法代码示例

本文整理汇总了Java中com.helger.commons.mock.CommonsTestHelper.testInParallel方法的典型用法代码示例。如果您正苦于以下问题:Java CommonsTestHelper.testInParallel方法的具体用法?Java CommonsTestHelper.testInParallel怎么用?Java CommonsTestHelper.testInParallel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.helger.commons.mock.CommonsTestHelper的用法示例。


在下文中一共展示了CommonsTestHelper.testInParallel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetCollatorSpaceBeforeDot

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testGetCollatorSpaceBeforeDot ()
{
  final Collator c = CollatorHelper.getCollatorSpaceBeforeDot (L_DE);
  assertNotNull (c);
  final Collator c2 = CollatorHelper.getCollatorSpaceBeforeDot (L_DE);
  assertNotNull (c2);
  assertNotSame (c, c2);
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (c, c2);

  // Unknown locale
  assertNotNull (CollatorHelper.getCollatorSpaceBeforeDot (new Locale ("xy", "87")));

  final List <Collator> res = new CommonsVector <> ();
  final int nMax = 100;
  CommonsTestHelper.testInParallel (nMax, () -> res.add (CollatorHelper.getCollatorSpaceBeforeDot (L_EN)));

  assertEquals (nMax, res.size ());
  for (int i = 1; i < nMax; ++i)
    CommonsTestHelper.testDefaultImplementationWithEqualContentObject (res.get (0), res.get (i));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:22,代码来源:CollatorHelperTest.java

示例2: testMultithreadedSAX_CachingSAXInputSource

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMultithreadedSAX_CachingSAXInputSource ()
{
  CommonsTestHelper.testInParallel (1000,
                                    (IThrowingRunnable <SAXException>) () -> assertTrue (SAXReader.readXMLSAX (new CachingSAXInputSource (new ClassPathResource ("xml/buildinfo.xml")),
                                                                                                               new SAXReaderSettings ().setContentHandler (new DefaultHandler ()))
                                                                                                  .isSuccess ()));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:SAXReaderTest.java

示例3: testMultithreadedSAX_ReadableResourceSAXInputSource

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMultithreadedSAX_ReadableResourceSAXInputSource ()
{
  CommonsTestHelper.testInParallel (1000,
                                    (IThrowingRunnable <SAXException>) () -> assertTrue (SAXReader.readXMLSAX (new ClassPathResource ("xml/buildinfo.xml"),
                                                                                                               new SAXReaderSettings ().setContentHandler (new DefaultHandler ()))
                                                                                                  .isSuccess ()));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:SAXReaderTest.java

示例4: testSort

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testSort ()
{
  final int nMax = 10000;
  CommonsTestHelper.testInParallel (nMax, () -> {
    Collator c = CollatorHelper.getCollatorSpaceBeforeDot (L_DE);
    assertEquals (-1, CompareHelper.compare ("1.1 a", "1.1.1 a", c));
    c = CollatorHelper.getCollatorSpaceBeforeDot (L_EN);
    assertEquals (-1, CompareHelper.compare ("1.1 a", "1.1.1 a", c));
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:12,代码来源:CollatorHelperTest.java

示例5: testWriteXMLMultiThreaded

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testWriteXMLMultiThreaded ()
{
  final String sSPACER = " ";
  final String sINDENT = XMLWriterSettings.DEFAULT_INDENTATION_STRING;
  final String sTAGNAME = "notext";

  CommonsTestHelper.testInParallel (1000, () -> {
    // Java 1.6 JAXP handles things differently
    final String sSerTagName = "<" + sTAGNAME + "></" + sTAGNAME + ">";

    final Document doc = XMLFactory.newDocument ("html", DOCTYPE_XHTML10_QNAME, DOCTYPE_XHTML10_URI);
    final Element aHead = (Element) doc.getDocumentElement ()
                                       .appendChild (doc.createElementNS (DOCTYPE_XHTML10_URI, "head"));
    aHead.appendChild (doc.createTextNode ("Hallo"));
    final Element aNoText = (Element) doc.getDocumentElement ()
                                         .appendChild (doc.createElementNS (DOCTYPE_XHTML10_URI, sTAGNAME));
    aNoText.appendChild (doc.createTextNode (""));

    // test including doc type
    final String sResult = XMLWriter.getNodeAsString (doc, XMLWriterSettings.createForXHTML ());
    assertEquals ("<!DOCTYPE html PUBLIC \"" +
                  DOCTYPE_XHTML10_QNAME +
                  "\"" +
                  sSPACER +
                  "\"" +
                  DOCTYPE_XHTML10_URI +
                  "\">" +
                  CRLF +
                  "<html xmlns=\"" +
                  DOCTYPE_XHTML10_URI +
                  "\">" +
                  CRLF +
                  sINDENT +
                  "<head>Hallo</head>" +
                  CRLF +
                  sINDENT +
                  sSerTagName +
                  CRLF +
                  "</html>" +
                  CRLF,
                  sResult);
    assertEquals (sResult, XMLWriter.getNodeAsString (doc, XMLWriterSettings.createForXHTML ()));
  });
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:46,代码来源:XMLWriterTest.java

示例6: testMultithreadedDOM

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMultithreadedDOM ()
{
  CommonsTestHelper.testInParallel (100,
                                    (IThrowingRunnable <SAXException>) () -> assertNotNull (DOMReader.readXMLDOM (new ClassPathResource ("xml/buildinfo.xml"))));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:7,代码来源:DOMReaderTest.java


注:本文中的com.helger.commons.mock.CommonsTestHelper.testInParallel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。