本文整理汇总了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)));
}
示例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);
}
示例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)
{}
}
示例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"));
}
示例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)
{}
}
示例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)
{}
}
示例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)
{}
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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 ()));
}
示例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> ());
}
示例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));
}
示例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)
{}
}