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


Java CommonsTestHelper.testDefaultImplementationWithDifferentContentObject方法代码示例

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


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

示例1: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  final SingleElementEnumeration <String> eit = new SingleElementEnumeration <> ("any");
  assertTrue (eit.hasMoreElements ());

  assertEquals ("any", eit.nextElement ());
  try
  {
    eit.nextElement ();
    fail ();
  }
  catch (final NoSuchElementException ex)
  {}
  assertFalse (eit.hasMoreElements ());

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new SingleElementEnumeration <> ("any"),
                                                                     new SingleElementEnumeration <> ("any"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new SingleElementEnumeration <> ("any"),
                                                                         new SingleElementEnumeration <> ("any2"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new SingleElementEnumeration <> ("any"),
                                                                         new SingleElementEnumeration <> (Integer.valueOf (1)));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:SingleElementEnumerationTest.java

示例2: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll () throws Exception
{
  final ObjectType ot1 = new ObjectType ("type1");
  final ObjectType ot2 = new ObjectType ("type2");
  final TypedObject <String> t1 = TypedObject.create (ot1, "id1");
  assertSame (ot1, t1.getObjectType ());
  assertEquals ("id1", t1.getID ());
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (t1, TypedObject.create (ot1, "id1"));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (t1, TypedObject.create (t1));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (t1, TypedObject.create (ot1, "id2"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (t1, TypedObject.create (ot2, "id1"));

  // Serialization
  CommonsTestHelper.testDefaultSerialization (t1);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:TypedObjectTest.java

示例3: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  GlobalIDFactory.setPersistentIntIDFactory (new MemoryStaticIntIDFactory ());
  final StringIDFromGlobalPersistentIntIDFactory x = new StringIDFromGlobalPersistentIntIDFactory ("idd");
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x,
                                                                     new StringIDFromGlobalPersistentIntIDFactory ("idd"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x,
                                                                         new StringIDFromGlobalPersistentIntIDFactory ("prefix"));
  assertTrue (x.getNewID ().startsWith ("idd"));

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

示例4: testHashCode

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testHashCode ()
{
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new Version (1, 2, 3, "4"),
                                                                     new Version (1, 2, 3, "4"));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new Version (1, 2, 3, "4"),
                                                                     Version.parse ("1.2.3.4"));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (new Version (1), Version.parse ("1"));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (Version.parse ("1"), Version.parse ("   1"));

  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new Version (1, 2, 3, "4"),
                                                                         new Version (1, 2, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new Version (1, 2, 3, "4"),
                                                                         new Version (1, 2, 3, "5"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new Version (1, 2, 3, "4"),
                                                                         Version.parse ("1.3.3.4"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (new Version (2), Version.parse ("1"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (Version.parse ("1"),
                                                                         Version.parse ("   11"));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:VersionTest.java

示例5: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
@SuppressFBWarnings ("TQ_NEVER_VALUE_USED_WHERE_ALWAYS_REQUIRED")
public void testAll ()
{
  final MemoryLongIDFactory x = new MemoryLongIDFactory (9);
  assertEquals (9, x.getNewID ());
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x, new MemoryLongIDFactory (10));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, new MemoryLongIDFactory (11));

  try
  {
    new MemoryLongIDFactory (-1);
    fail ();
  }
  catch (final IllegalArgumentException ex)
  {}
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:MemoryLongIDFactoryTest.java

示例6: testDefault

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testDefault () throws Exception
{
  final ClassPathResource aCPISP1a = new ClassPathResource ("folder/test2.txt");
  final ClassPathResource aCPISP1b = new ClassPathResource ("folder/test2.txt");
  final ClassPathResource aCPISP2 = new ClassPathResource ("folder/test1.txt");
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aCPISP1a, aCPISP1b);
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aCPISP1a,
                                                                     new ClassPathResource ("cp:folder/test2.txt"));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aCPISP1a,
                                                                     new ClassPathResource ("classpath:folder/test2.txt"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aCPISP1a, aCPISP2);
  CommonsTestHelper.testDefaultSerialization (aCPISP1a);
  CommonsTestHelper.testDefaultSerialization (new ClassPathResource ("folder/test2.txt"));
  try
  {
    // Can't serialize with class loader
    CommonsTestHelper.testDefaultSerialization (new ClassPathResource ("folder/test2.txt",
                                                                       ClassLoaderHelper.getDefaultClassLoader ()));
    fail ();
  }
  catch (final IllegalArgumentException ex)
  {}
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:ClassPathResourceTest.java

示例7: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  final StringIDFromGlobalLongIDFactory x = new StringIDFromGlobalLongIDFactory ("idd");
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x, new StringIDFromGlobalLongIDFactory ("idd"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x,
                                                                         new StringIDFromGlobalLongIDFactory ("prefix"));
  assertTrue (x.getNewID ().startsWith ("idd"));

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

示例8: testEqualsAndHashcode

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testEqualsAndHashcode ()
{
  final SafeVector <String> sl = new SafeVector <> ();
  sl.set (10, "any");
  assertNull (sl.get (9));

  final SafeVector <String> sl2 = new SafeVector <> ();
  sl2.set (10, "any");

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (sl, sl2);
  sl2.set (9, "x");
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (sl, sl2);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:15,代码来源:SafeVectorTest.java

示例9: testEqualsAndHashcode

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testEqualsAndHashcode ()
{
  final SafeArrayList <String> sl = new SafeArrayList <> ();
  sl.set (10, "any");
  assertNull (sl.get (9));

  final SafeArrayList <String> sl2 = new SafeArrayList <> ();
  sl2.set (10, "any");

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (sl, sl2);
  sl2.set (9, "x");
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (sl, sl2);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:15,代码来源:SafeArrayListTest.java

示例10: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final CSSWriterSettings aSettings = new CSSWriterSettings (ECSSVersion.CSS30, false);
  final CSSHSL aColor = new CSSHSL (1, 2, 3);
  assertEquals ("hsl(1,2%,3%)", aColor.getAsCSSString (aSettings));

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSHSL (aColor));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSHSL (1, 2, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSHSL (0, 2, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSHSL (1, 0, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSHSL (1, 2, 0));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:14,代码来源:CSSHSLTest.java

示例11: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final CSSWriterSettings aSettings = new CSSWriterSettings (ECSSVersion.CSS30, false);
  final CSSRGBA aColor = new CSSRGBA (1, 2, 3, 0.5f);
  assertEquals ("rgba(1,2,3,0.5)", aColor.getAsCSSString (aSettings));

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSRGBA (aColor));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSRGBA (1, 2, 3, 0.5f));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGBA (0, 2, 3, 0.5f));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGBA (1, 0, 3, 0.5f));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGBA (1, 2, 0, 0.5f));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGBA (1, 2, 3, 0f));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:15,代码来源:CSSRGBATest.java

示例12: testDefault

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testDefault ()
{
  final LSResourceData rd = new LSResourceData ("http://www.w3.org/2001/XMLSchema",
                                                "http://www.example.org/schema1",
                                                null,
                                                "schema1.xsd",
                                                "my/path/xml/schema2.xsd");
  assertEquals ("http://www.w3.org/2001/XMLSchema", rd.getType ());
  assertEquals ("http://www.example.org/schema1", rd.getNamespaceURI ());
  assertNull (rd.getPublicID ());
  assertEquals ("schema1.xsd", rd.getSystemID ());
  assertNotNull (rd.getBaseURI ());
  assertTrue (rd.getBaseURI ().endsWith ("xml/schema2.xsd"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (rd,
                                                                         new LSResourceData (null,
                                                                                             null,
                                                                                             null,
                                                                                             null,
                                                                                             null));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (rd,
                                                                     new LSResourceData (rd.getType (),
                                                                                         rd.getNamespaceURI (),
                                                                                         rd.getPublicID (),
                                                                                         rd.getSystemID (),
                                                                                         rd.getBaseURI ()));
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:28,代码来源:LSResourceDataTest.java

示例13: testEqualsHashCode

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testEqualsHashCode ()
{
  final DefaultTree <String> t = new DefaultTree <> ();
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (t, new DefaultTree <String> ());
  t.getRootItem ().createChildItem ("data");
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (t, new DefaultTree <String> ());
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:DefaultTreeTest.java

示例14: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final CSSWriterSettings aSettings = new CSSWriterSettings (ECSSVersion.CSS30, false);
  final CSSRGB aColor = new CSSRGB (1, 2, 3);
  assertEquals ("rgb(1,2,3)", aColor.getAsCSSString (aSettings));

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSRGB (aColor));
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (aColor, new CSSRGB (1, 2, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGB (0, 2, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGB (1, 0, 3));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (aColor, new CSSRGB (1, 2, 0));
}
 
开发者ID:phax,项目名称:ph-css,代码行数:14,代码来源:CSSRGBTest.java

示例15: testAll

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testAll ()
{
  SuccessWithValue <String> x = new SuccessWithValue <> (ESuccess.SUCCESS, "bla");
  assertTrue (x.isSuccess ());
  assertFalse (x.isFailure ());
  assertEquals ("bla", x.get ());
  assertEquals ("bla", x.getIfSuccess ("other"));
  assertEquals ("bla", x.getIfSuccessOrNull ());
  assertEquals ("other", x.getIfFailure ("other"));
  assertNull (x.getIfFailureOrNull ());

  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (x, SuccessWithValue.createSuccess ("bla"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, SuccessWithValue.createFailure ("bla"));
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (x, SuccessWithValue.createSuccess ("Other"));

  x = new SuccessWithValue <> (ESuccess.SUCCESS, null);
  assertNull (x.get ());

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


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