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


Java CommonsTestHelper.testDefaultSerialization方法代码示例

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


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

示例1: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic () throws Exception
{
  assertTrue (AbstractSessionSingleton.getAllSessionSingletons ().isEmpty ());
  assertFalse (AbstractSessionSingleton.isSessionSingletonInstantiated (MockSessionSingleton.class));
  assertNull (AbstractSessionSingleton.getSessionSingletonIfInstantiated (MockSessionSingleton.class));

  final MockSessionSingleton a = MockSessionSingleton.getInstance ();
  assertTrue (AbstractSessionSingleton.isSessionSingletonInstantiated (MockSessionSingleton.class));
  assertSame (a, AbstractSessionSingleton.getSessionSingletonIfInstantiated (MockSessionSingleton.class));
  assertEquals (0, a.get ());
  a.inc ();
  assertEquals (1, a.get ());
  assertSame (a, MockSessionSingleton.getInstance ());

  CommonsTestHelper.testDefaultSerialization (a);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:SessionSingletonFuncTest.java

示例2: testBasicWithScopeCtor

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasicWithScopeCtor () throws Exception
{
  assertTrue (AbstractSessionSingleton.getAllSessionSingletons ().isEmpty ());
  assertFalse (AbstractSessionSingleton.isSessionSingletonInstantiated (MockSessionSingletonWithScopeCtor.class));
  assertNull (AbstractSessionSingleton.getSessionSingletonIfInstantiated (MockSessionSingletonWithScopeCtor.class));

  final MockSessionSingletonWithScopeCtor a = MockSessionSingletonWithScopeCtor.getInstance ();
  assertNotNull (a);
  assertTrue (AbstractSessionSingleton.isSessionSingletonInstantiated (MockSessionSingletonWithScopeCtor.class));
  assertSame (a,
              AbstractSessionSingleton.getSessionSingletonIfInstantiated (MockSessionSingletonWithScopeCtor.class));
  assertNotNull (a.getScope ());
  assertEquals (0, a.get ());
  a.inc ();
  assertEquals (1, a.get ());
  assertSame (a, MockSessionSingletonWithScopeCtor.getInstance ());

  CommonsTestHelper.testDefaultSerialization (a);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:SessionSingletonFuncTest.java

示例3: 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

示例4: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsMap <String, String> aTest = new CommonsTreeMap<> ();
  aTest.put ("aaa", "bla");
  aTest.put ("bbb", "blb");
  aTest.put ("ccc", "blc");

  final ICommonsOrderedSet <String> aSortedKeys = aTest.getSortedByKey (Comparator.naturalOrder ()).copyOfKeySet ();
  assertEquals ("aaa", aSortedKeys.getAtIndex (0));
  assertEquals ("bbb", aSortedKeys.getAtIndex (1));
  assertEquals ("ccc", aSortedKeys.getAtIndex (2));

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

示例5: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsSet <String> aTest = new CommonsHashSet<> ();
  aTest.add ("aaa");
  aTest.add ("bbb");
  aTest.add ("ccc");

  final ICommonsList <String> aSortedKeys = aTest.getSorted (Comparator.naturalOrder ());
  assertEquals ("aaa", aSortedKeys.getAtIndex (0));
  assertEquals ("bbb", aSortedKeys.getAtIndex (1));
  assertEquals ("ccc", aSortedKeys.getAtIndex (2));

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

示例6: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsMap <String, String> aTest = new CommonsConcurrentHashMap<> ();
  aTest.put ("aaa", "bla");
  aTest.put ("bbb", "blb");
  aTest.put ("ccc", "blc");

  final ICommonsSet <String> aSortedKeys = aTest.getSortedByKey (Comparator.naturalOrder ()).copyOfKeySet ();
  assertEquals ("aaa", aSortedKeys.getAtIndex (0));
  assertEquals ("bbb", aSortedKeys.getAtIndex (1));
  assertEquals ("ccc", aSortedKeys.getAtIndex (2));

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

示例7: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsSet <String> aTest = new CommonsLinkedHashSet<> ();
  aTest.add ("aaa");
  aTest.add ("bbb");
  aTest.add ("ccc");

  final ICommonsList <String> aSortedKeys = aTest.getSorted (Comparator.naturalOrder ());
  assertEquals ("aaa", aSortedKeys.getAtIndex (0));
  assertEquals ("bbb", aSortedKeys.getAtIndex (1));
  assertEquals ("ccc", aSortedKeys.getAtIndex (2));

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

示例8: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsMap <String, String> aTest = new CommonsWeakHashMap<> ();
  aTest.put ("aaa", "bla");
  aTest.put ("bbb", "blb");
  aTest.put ("ccc", "blc");

  final ICommonsOrderedSet <String> aSortedKeys = aTest.getSortedByKey (Comparator.naturalOrder ()).copyOfKeySet ();
  assertEquals ("aaa", aSortedKeys.getAtIndex (0));
  assertEquals ("bbb", aSortedKeys.getAtIndex (1));
  assertEquals ("ccc", aSortedKeys.getAtIndex (2));

  if (false)
    CommonsTestHelper.testDefaultSerialization (aTest);
  CommonsTestHelper.testGetClone (aTest);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:CommonsWeakHashMapTest.java

示例9: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsMap <String, String> aTest = new CommonsLinkedHashMap<> ();
  aTest.put ("aaa", "bla");
  aTest.put ("bbb", "blb");
  aTest.put ("ccc", "blc");

  final ICommonsOrderedSet <String> aSortedKeys = aTest.getSortedByKey (Comparator.naturalOrder ()).copyOfKeySet ();
  assertEquals ("aaa", aSortedKeys.getAtIndex (0));
  assertEquals ("bbb", aSortedKeys.getAtIndex (1));
  assertEquals ("ccc", aSortedKeys.getAtIndex (2));

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

示例10: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsList <String> aTest = new CommonsArrayList<> ();
  assertTrue (aTest.isEmpty ());
  aTest.add ("aaa");
  aTest.add ("bbb");
  aTest.add ("ccc");

  CommonsTestHelper.testDefaultSerialization (aTest);
  CommonsTestHelper.testGetClone (aTest);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:CommonsArrayListTest.java

示例11: testDefaultImpl

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testDefaultImpl ()
{
  ExtendedEmailAddress a = new ExtendedEmailAddress ();
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (a, new ExtendedEmailAddress ());
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (a, new ExtendedEmailAddress (a));
  CommonsTestHelper.testGetClone (a);

  a = new ExtendedEmailAddress ();
  a.setType (EEmailAddressType.PERSONAL);
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (a, new ExtendedEmailAddress ());
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (a, new ExtendedEmailAddress (a));
  CommonsTestHelper.testGetClone (a);

  a = new ExtendedEmailAddress ();
  a.setAddress ("[email protected]");
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (a, new ExtendedEmailAddress ());
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (a, new ExtendedEmailAddress (a));
  CommonsTestHelper.testGetClone (a);

  a = new ExtendedEmailAddress ();
  a.setPersonal ("Ich & Du");
  CommonsTestHelper.testDefaultImplementationWithDifferentContentObject (a, new ExtendedEmailAddress ());
  CommonsTestHelper.testDefaultImplementationWithEqualContentObject (a, new ExtendedEmailAddress (a));
  CommonsTestHelper.testGetClone (a);
  CommonsTestHelper.testDefaultSerialization (a);
}
 
开发者ID:phax,项目名称:ph-masterdata,代码行数:28,代码来源:ExtendedEmailAddressTest.java

示例12: testSerialize

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testSerialize ()
{
  final JsonObject aObject = new JsonObject ();
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key1", true);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key2", (byte) 3);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key3", 'x');
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key4", 50);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key5", 51L);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key6", (short) 52);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key7", 3.1234);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key8", 3.1235f);
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key9", "This is a string");
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key10", new JsonArray ().add ("nested").add (0).add (Double.valueOf (12.34)));
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add ("key11", new JsonObject ().add ("n1", "nested").add ("n2", 0).add ("n3", Double.valueOf (12.34)));
  CommonsTestHelper.testDefaultSerialization (aObject);
  aObject.add (new MapEntry <> ("key12", "value12"));
  CommonsTestHelper.testDefaultSerialization (aObject);

  final JsonObject aObject2 = new JsonObject ();
  aObject2.addAll (aObject);
  CommonsTestHelper.testDefaultSerialization (aObject2);
  aObject2.addAll (new StringMap ().add ("a", "b").add ("c", "d"));
  CommonsTestHelper.testDefaultSerialization (aObject2);
  aObject2.addAllMapped (new StringMap ().add ("a", "b").add ("c", "d"), JsonValue::create);
  CommonsTestHelper.testDefaultSerialization (aObject2);
  aObject2.addAllMapped (new StringMap ().add ("e", "f").add ("g", "h"), Function.identity (), JsonValue::create);
  CommonsTestHelper.testDefaultSerialization (aObject2);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:41,代码来源:JsonObjectTest.java

示例13: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic () throws Exception
{
  assertTrue (AbstractSessionSingleton.getAllSessionSingletons ().isEmpty ());
  assertFalse (AbstractSessionSingleton.isSessionSingletonInstantiated (MockSessionSingletonTreeWithUniqueID.class));
  assertNull (AbstractSessionSingleton.getSessionSingletonIfInstantiated (MockSessionSingletonTreeWithUniqueID.class));

  final MockSessionSingletonTreeWithUniqueID a = MockSessionSingletonTreeWithUniqueID.getInstance ();
  assertNotNull (a);
  assertTrue (AbstractSessionSingleton.isSessionSingletonInstantiated (MockSessionSingletonTreeWithUniqueID.class));
  assertSame (a,
              AbstractSessionSingleton.getSessionSingletonIfInstantiated (MockSessionSingletonTreeWithUniqueID.class));

  final MockSessionSingletonTreeWithUniqueID b = MockSessionSingletonTreeWithUniqueID.getInstance ();
  assertSame (a, b);

  if (false)
    CommonsTestHelper.testDefaultSerialization (a);

  assertNotNull (a.getRootItem ());
  assertFalse (a.hasChildren (a.getRootItem ()));
  assertEquals (0, a.getChildCount (a.getRootItem ()));
  final DefaultTreeItemWithID <String, String> aItem1 = a.getRootItem ().createChildItem ("id1", "value1");
  assertSame (aItem1, a.getChildWithID (a.getRootItem (), "id1"));
  assertEquals (1, a.getChildCount (a.getRootItem ()));
  assertEquals (1, a.getAllChildren (a.getRootItem ()).size ());
  assertSame (aItem1, a.getItemWithID ("id1"));
  assertEquals (1, a.getAllItems ().size ());
  final DefaultTreeItemWithID <String, String> aItem2 = aItem1.createChildItem ("id2", "value2");
  assertEquals (2, a.getAllItems ().size ());
  assertTrue (a.isItemSameOrDescendant (aItem1.getID (), aItem2.getID ()));
  assertFalse (a.isItemSameOrDescendant (aItem2.getID (), aItem1.getID ()));
  assertTrue (a.containsItemWithID (aItem1.getID ()));
  assertEquals ("value1", a.getItemDataWithID (aItem1.getID ()));
  assertEquals (2, a.getAllItemDatas ().size ());
  assertTrue (a.removeItemWithID ("id2").isChanged ());
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:38,代码来源:SessionSingletonTreeWithUniqueIDFuncTest.java

示例14: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsList <String> aTest = new CommonsLinkedList<> ();
  assertTrue (aTest.isEmpty ());
  aTest.add ("aaa");
  aTest.add ("bbb");
  aTest.add ("ccc");

  CommonsTestHelper.testDefaultSerialization (aTest);
  CommonsTestHelper.testGetClone (aTest);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:CommonsLinkedListTest.java

示例15: testBasic

import com.helger.commons.mock.CommonsTestHelper; //导入方法依赖的package包/类
@Test
public void testBasic ()
{
  final ICommonsList <String> aTest = new CommonsVector<> ();
  assertTrue (aTest.isEmpty ());
  aTest.add ("aaa");
  aTest.add ("bbb");
  aTest.add ("ccc");

  CommonsTestHelper.testDefaultSerialization (aTest);
  CommonsTestHelper.testGetClone (aTest);
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:13,代码来源:CommonsVectorTest.java


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