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


Java CommonsTestHelper.testToStringImplementation方法代码示例

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


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

示例1: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  for (int i = 0; i < 2; ++i)
  {
    final DefaultTransformURIResolver res = new DefaultTransformURIResolver (i == 0 ? null
                                                                                    : new LoggingTransformURIResolver ());
    final TransformerFactory fac = XMLTransformerFactory.createTransformerFactory (null, res);
    assertNotNull (fac);

    // Read valid XSLT
    Templates t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test1.xslt"));
    assertNotNull (t1);

    // Read valid XSLT with valid include
    t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test2.xslt"));
    assertNotNull (t1);

    // Read valid XSLT with invalid include
    t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test3.xslt"));
    assertNull (t1);

    CommonsTestHelper.testToStringImplementation (res);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:26,代码来源:DefaultTransformURIResolverTest.java

示例2: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  final LoggingTransformErrorListener el = new LoggingTransformErrorListener (L_EN);
  final TransformerFactory fac = XMLTransformerFactory.createTransformerFactory (el,
                                                                                 new LoggingTransformURIResolver ());
  assertNotNull (fac);

  // Read valid XSLT
  Templates t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test1.xslt"));
  assertNotNull (t1);

  // Read valid XSLT (with import)
  t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test2.xslt"));
  assertNotNull (t1);

  // Read invalid XSLT
  assertNull (XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("test1.txt")));

  CommonsTestHelper.testToStringImplementation (el);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:22,代码来源:LoggingTransformErrorListenerTest.java

示例3: testIteration5

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testIteration5 ()
{
  // filtered elements at the beginning
  final List <String> aList = CollectionHelper.newList (null, null, "s1", "s2", "s3");
  final FilterIterator <String> it = new FilterIterator <> (aList, Objects::nonNull);
  assertNotNull (it);

  assertEquals ("s1", it.next ());
  assertEquals ("s2", it.next ());
  assertEquals ("s3", it.next ());

  CommonsTestHelper.testToStringImplementation (it);

  try
  {
    // can't call next if hasNext failed
    it.next ();
    fail ();
  }
  catch (final NoSuchElementException ex)
  {}
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:FilterIteratorTest.java

示例4: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final IMicroElement e1 = new MicroElement ("a1");
  final IMicroElement e2 = new MicroElement ("a1");
  MicroEvent e = new MicroEvent (EMicroEvent.NODE_INSERTED, e1, e2);
  assertEquals (EMicroEvent.NODE_INSERTED, e.getEventType ());
  assertSame (e1, e.getSourceNode ());
  assertSame (e2, e.getTargetNode ());
  CommonsTestHelper.testToStringImplementation (e);

  e = new MicroEvent (EMicroEvent.NODE_INSERTED, null, null);
  assertEquals (EMicroEvent.NODE_INSERTED, e.getEventType ());
  assertNull (e.getSourceNode ());
  assertNull (e.getTargetNode ());
  CommonsTestHelper.testToStringImplementation (e);

  try
  {
    new MicroEvent (null, e1, e2);
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:26,代码来源:MicroEventTest.java

示例5: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll () throws IOException
{
  final NonBlockingStringWriter aSW = new NonBlockingStringWriter ();
  try (final WrappedWriter ws = new WrappedWriter (aSW))
  {
    ws.write ('a');
    ws.write ("bc".toCharArray ());
    ws.write ("de".toCharArray (), 0, 1);
    ws.write ("ef");
    ws.write ("fgh", 1, 1);
    assertEquals ("abcdefg", aSW.getAsString ());
    ws.append ('0').append ("12").append ("234", 1, 2);
    assertEquals ("abcdefg0123", aSW.getAsString ());
    ws.flush ();
    CommonsTestHelper.testToStringImplementation (ws);
  }

  try (final WrappedWriter ws = new WrappedWriter (null))
  {
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:26,代码来源:WrappedWriterTest.java

示例6: testBindAllValidSchematrons

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBindAllValidSchematrons () throws SchematronException
{
  for (final IReadableResource aRes : SchematronTestHelper.getAllValidSchematronFiles ())
  {
    // Parse the schema
    final PSSchema aSchema = new PSReader (aRes).readSchema ();
    assertNotNull (aSchema);
    CommonsTestHelper.testToStringImplementation (aSchema);

    final CollectingPSErrorHandler aLogger = new CollectingPSErrorHandler ();
    assertTrue (aRes.getPath (), aSchema.isValid (aLogger));
    assertTrue (aLogger.isEmpty ());

    // Create a compiled schema
    final String sPhaseID = null;
    final IPSErrorHandler aErrorHandler = null;
    final IPSBoundSchema aBoundSchema = PSXPathQueryBinding.getInstance ().bind (aSchema, sPhaseID, aErrorHandler);
    assertNotNull (aBoundSchema);
  }
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:22,代码来源:PSXPathBoundSchemaTest.java

示例7: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
@SuppressFBWarnings (value = "DLS_DEAD_LOCAL_STORE")
public void testAll ()
{
  final BasicThreadFactory x = new BasicThreadFactory.Builder ().setDaemon (false)
                                                                .setPriority (Thread.NORM_PRIORITY)
                                                                .setNamingPattern ("pool %d")
                                                                .build ();
  for (int i = 0; i < 2; ++i)
  {
    final Thread t = x.newThread ( () -> {
      // nada
      if (false)
        s_aLogger.info ("In thread '" + Thread.currentThread ().getName () + "'");
    });
    assertNotNull (t);
    t.start ();
  }
  CommonsTestHelper.testToStringImplementation (x);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:BasicThreadFactoryTest.java

示例8: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll () throws TransformerConfigurationException, TransformerException
{
  final CollectingTransformErrorListener el = new CollectingTransformErrorListener ();
  final TransformerFactory fac = XMLTransformerFactory.createTransformerFactory (el.andThen (new LoggingTransformErrorListener (L_EN)),
                                                                                 new LoggingTransformURIResolver ());
  assertNotNull (fac);

  // Read valid XSLT
  Templates t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test1.xslt"));
  assertNotNull (t1);
  // May contain warning in JDK 1.7
  // (http://javax.xml.XMLConstants/property/accessExternalDTD is unknown)
  assertTrue (el.getErrorList ().containsNoError ());

  // Try a real transformation
  {
    final Document aDoc = XMLFactory.newDocument ();
    t1.newTransformer ().transform (TransformSourceFactory.create (new ClassPathResource ("xml/xslt1.xml")),
                                    new DOMResult (aDoc));
    assertNotNull (aDoc);
    assertNotNull (aDoc.getDocumentElement ());
    assertEquals ("html", aDoc.getDocumentElement ().getTagName ());
  }

  // Read valid XSLT (with import)
  t1 = XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("xml/test2.xslt"));
  assertNotNull (t1);
  // May contain warning in JDK 1.7
  // (http://javax.xml.XMLConstants/property/accessExternalDTD is unknown)
  assertTrue (el.getErrorList ().containsNoError ());

  // Read invalid XSLT
  assertNull (XMLTransformerFactory.newTemplates (fac, new ClassPathResource ("test1.txt")));
  assertTrue (el.getErrorList ().containsAtLeastOneError ());

  CommonsTestHelper.testToStringImplementation (el);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:39,代码来源:CollectingTransformErrorListenerTest.java

示例9: testMisc

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testMisc ()
{
  assertEquals ("<!DOCTYPE qname PUBLIC \"pubid\" \"sysid\">",
                XMLEmitter.getDocTypeHTMLRepresentation (EXMLSerializeVersion.XML_10,
                                                         EXMLIncorrectCharacterHandling.DEFAULT,
                                                         new MicroDocumentType ("qname", "pubid", "sysid")));
  assertEquals ("<!DOCTYPE qname PUBLIC \"pubid\" \"sysid\">",
                XMLEmitter.getDocTypeHTMLRepresentation (EXMLSerializeVersion.XML_11,
                                                         EXMLIncorrectCharacterHandling.DEFAULT,
                                                         new MicroDocumentType ("qname", "pubid", "sysid")));
  CommonsTestHelper.testToStringImplementation (new XMLEmitter (new ByteArrayOutputStreamProvider ().getWriter (StandardCharsets.ISO_8859_1,
                                                                                                                EAppend.DEFAULT),
                                                                XMLWriterSettings.DEFAULT_XML_SETTINGS));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:16,代码来源:XMLEmitterTest.java

示例10: testDefault

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testDefault ()
{
  LoggingLSResourceResolver lrr = new LoggingLSResourceResolver ();
  lrr.resolveResource ("xsd", "nsuri", null, "sysid", "baseURI");

  CommonsTestHelper.testToStringImplementation (lrr);

  lrr = new LoggingLSResourceResolver ();
  lrr.setWrappedResourceResolver (new LoggingLSResourceResolver ());
  lrr.resolveResource ("xsd", "nsuri", null, "sysid", "baseURI");
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:LoggingLSResourceResolverTest.java

示例11: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@SuppressWarnings ("resource")
@Test
public void testAll () throws IOException
{
  final NonBlockingByteArrayInputStream baos = new NonBlockingByteArrayInputStream (new byte [100]);
  final WrappedInputStream ws = new WrappedInputStream (baos);
  assertTrue (ws.markSupported ());
  assertEquals (100, ws.available ());
  ws.mark (0);
  ws.read ();
  ws.read (new byte [4]);
  ws.read (new byte [5], 1, 1);
  ws.skip (4);
  assertEquals (90, ws.available ());
  ws.reset ();
  assertEquals (100, ws.available ());
  ws.close ();
  CommonsTestHelper.testToStringImplementation (ws);

  try
  {
    new WrappedInputStream (null).close ();
    fail ();
  }
  catch (final NullPointerException ex)
  {}
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:28,代码来源:WrappedInputStreamTest.java

示例12: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll () throws IOException
{
  CountingFileInputStream aCIS = new CountingFileInputStream ("pom.xml");
  try
  {
    aCIS.read ();
    assertEquals (1, aCIS.read (new byte [5], 1, 1));
    StreamHelper.copyInputStreamToOutputStream (aCIS, new NonBlockingByteArrayOutputStream ());
    CommonsTestHelper.testToStringImplementation (aCIS);
  }
  finally
  {
    StreamHelper.close (aCIS);
  }

  aCIS = new CountingFileInputStream (new File ("pom.xml"));
  try
  {
    aCIS.read ();
    assertEquals (1, aCIS.read (new byte [5], 1, 1));
    StreamHelper.copyInputStreamToOutputStream (aCIS, new NonBlockingByteArrayOutputStream ());
    CommonsTestHelper.testToStringImplementation (aCIS);
  }
  finally
  {
    StreamHelper.close (aCIS);
  }
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:30,代码来源:CountingFileInputStreamTest.java

示例13: testCtor

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testCtor ()
{
  final IFileOperationManager aFOM = new FileOperationManager ();
  assertNull (aFOM.getLastError ());
  assertNull (aFOM.getLastOperation ());
  CommonsTestHelper.testToStringImplementation (aFOM);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:FileOperationManagerTest.java

示例14: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  final FormatterStringSkipPrefixAndSuffix fp = new FormatterStringSkipPrefixAndSuffix ("a", "o");
  assertEquals ("bc", fp.apply ("abco"));
  assertEquals ("bc", fp.apply ("abc"));
  assertEquals ("bc", fp.apply ("bco"));
  assertEquals ("bc", fp.apply ("bc"));
  CommonsTestHelper.testToStringImplementation (fp);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:11,代码来源:FormatterStringSkipPrefixAndSuffixTest.java

示例15: testSuffix

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testSuffix ()
{
  final FormatterStringSkipPrefixAndSuffix fp = FormatterStringSkipPrefixAndSuffix.createSuffixOnly ("o");
  assertEquals ("abc", fp.apply ("abco"));
  assertEquals ("abc", fp.apply ("abc"));
  assertEquals ("bc", fp.apply ("bco"));
  assertEquals ("bc", fp.apply ("bc"));
  CommonsTestHelper.testToStringImplementation (fp);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:11,代码来源:FormatterStringSkipPrefixAndSuffixTest.java


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