本文整理汇总了Java中org.apache.harmony.testframework.serialization.SerializationTest类的典型用法代码示例。如果您正苦于以下问题:Java SerializationTest类的具体用法?Java SerializationTest怎么用?Java SerializationTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializationTest类属于org.apache.harmony.testframework.serialization包,在下文中一共展示了SerializationTest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSerializationResourceBundle
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests resolution of resource bundle for serialization/deserialization.
*/
public void testSerializationResourceBundle() throws Exception {
// test case: valid resource bundle name
lr.setResourceBundleName("bundles/java/util/logging/res2");
lr.setResourceBundle(ResourceBundle.getBundle(
"bundles/java/util/logging/res", Locale.US));
LogRecord result = (LogRecord) SerializationTest.copySerializable(lr);
assertNotNull(result.getResourceBundle());
// test case: invalid resource bundle name, it is not resolved during
// deserialization LogRecord object so check for returned null value
lr.setResourceBundleName("bad bundle name");
lr.setResourceBundle(ResourceBundle.getBundle(
"bundles/java/util/logging/res", Locale.US));
result = (LogRecord) SerializationTest.copySerializable(lr);
assertNull(result.getResourceBundle());
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:23,代码来源:LogRecordTest.java
示例2: testSerialization_InstanceLevel
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*
* Test serialization of normal instance of Level. It is expected that the
* deserialized level object should be equal to the original one.
*/
public void testSerialization_InstanceLevel() throws Exception {
// tests that objects are the same
Level[] objectsToTest = new Level[] { Level.parse("550")};
SerializationTest.verifySelf(objectsToTest,
SerializationTest.SAME_COMPARATOR);
// tests that objects are the equals
objectsToTest = new Level[] {
new MockLevel("123", 123, "bundle"),
new MockLevel("123", 123, null) };
SerializationTest.verifySelf(objectsToTest, LEVEL_COMPARATOR);
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:22,代码来源:LevelTest.java
示例3: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
public void testSerializationCompatibility() throws Exception {
// regression test for Harmony-1163
HashMap<Color, Integer> enumColorMap = new HashMap<Color, Integer>();
enumColorMap.put(Color.Red, 1);
enumColorMap.put(Color.Blue, 3);
Object[] testCases = { Sample.CURLY, new MockEnum(),
// test a class that has enums and a string of same name as its fields.
new MockEnum2(),
// test a map class that has enums.
enumColorMap, };
SerializationTest.verifyGolden(this, testCases);
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:19,代码来源:EnumTest.java
示例4: assertDeserialized
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
public void assertDeserialized(Serializable initial, Serializable deserialized) {
// do common checks for all throwable objects
SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial, deserialized);
PatternSyntaxException initPatternSyntaxException = (PatternSyntaxException) initial;
PatternSyntaxException dserPatternSyntaxException = (PatternSyntaxException) deserialized;
// verify fields
assertEquals(initPatternSyntaxException.getDescription(),
dserPatternSyntaxException.getDescription());
assertEquals(initPatternSyntaxException.getPattern(),
dserPatternSyntaxException.getPattern());
assertEquals(initPatternSyntaxException.getIndex(),
dserPatternSyntaxException.getIndex());
}
开发者ID:Sellegit,项目名称:j2objc,代码行数:17,代码来源:PatternSyntaxExceptionTest.java
示例5: testSerializationComptibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
public void testSerializationComptibility() throws Exception {
final BeanContextServicesSupport ctx = new BeanContextServicesSupport(
null, Locale.ITALY, true, true);
final BeanContextServicesSupport ctx2 = new BeanContextServicesSupport(
null, Locale.CHINA, true, true);
BeanContextEvent event = new MockBeanContextEvent(ctx);
event.setPropagatedFrom(ctx2);
SerializationTest.verifyGolden(this, event, new SerializableAssert(){
public void assertDeserialized(Serializable arg0, Serializable arg1) {
BeanContextEvent e1 = (BeanContextEvent)arg0;
BeanContextEvent e2 = (BeanContextEvent)arg1;
assertNull((BeanContextServicesSupport)e2.getSource());
assertNotNull((BeanContextServicesSupport)e1.getSource());
assertEqualsSerially((BeanContextServicesSupport)e1.getPropagatedFrom(), (BeanContextServicesSupport)e2.getPropagatedFrom());
assertEqualsSerially(ctx2, (BeanContextServicesSupport)e2.getPropagatedFrom());
}
});
}
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:BeanContextEventTest.java
示例6: assertDeserialized
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
public void assertDeserialized(Serializable initial,
Serializable deserialized) {
// do common checks for all throwable objects
SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
deserialized);
DataTruncation initThr = (DataTruncation) initial;
DataTruncation dserThr = (DataTruncation) deserialized;
// verify index
assertEquals(initThr.getIndex(), dserThr.getIndex());
// verify parameter
assertEquals(initThr.getParameter(), dserThr.getParameter());
// verify read
assertEquals(initThr.getRead(), dserThr.getRead());
// verify dataSize
assertEquals(initThr.getDataSize(), dserThr.getDataSize());
// verify transferSize
assertEquals(initThr.getTransferSize(), dserThr.getTransferSize());
}
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:DataTruncationTest.java
示例7: test_Serialization
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests java.util.HashSet#SerializationTest
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationGolden",
args = {}
)
})
public void test_Serialization() throws Exception{
HashSet<String> hs = new HashSet<String>();
hs.add("hello");
hs.add("world");
SerializationTest.verifySelf(hs, comparator);
SerializationTest.verifyGolden(this, hs, comparator);
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:25,代码来源:HashSetTest.java
示例8: testSerialization
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
@TestTargets({
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization.",
method = "!SerializationGolden",
args = {}
)
})
public void testSerialization() throws Exception {
Pattern pat = Pattern.compile("a*bc");
SerializableAssert comparator = new SerializableAssert() {
public void assertDeserialized(Serializable initial,
Serializable deserialized) {
assertEquals(((Pattern) initial).toString(),
((Pattern) deserialized).toString());
}
};
SerializationTest.verifyGolden(this, pat, comparator);
SerializationTest.verifySelf(pat, comparator);
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:27,代码来源:PatternTest.java
示例9: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Serialization test",
method = "!SerializationGolden",
args = {}
)
public void testSerializationCompatibility() throws Exception {
SQLException nextSQLException = new SQLException("nextReason",
"nextSQLState", 33);
int vendorCode = 10;
SQLException object = new SQLException("reason", "SQLState", vendorCode);
object.setNextException(nextSQLException);
SerializationTest.verifyGolden(this, object, SQLEXCEPTION_COMPARATOR);
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:SQLExceptionTest.java
示例10: testSerializationSelf
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
method = "ReadOnlyBufferException",
args = {}
)
})
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new ReadOnlyBufferException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:ReadOnlyBufferExceptionTest.java
示例11: testSerializationSelf
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "CancelledKeyException",
args = {}
)
})
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new CancelledKeyException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:CancelledKeyExceptionTest.java
示例12: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationGolden",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "FileLockInterruptionException",
args = {}
)
})
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this,
new FileLockInterruptionException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:FileLockInterruptionExceptionTest.java
示例13: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationGolden",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "ClosedByInterruptException",
args = {}
)
})
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new ClosedByInterruptException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:ClosedByInterruptExceptionTest.java
示例14: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationGolden",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "ClosedSelectorException",
args = {}
)
})
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new ClosedSelectorException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:ClosedSelectorExceptionTest.java
示例15: testSerializationSelf
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "NonWritableChannelException",
args = {}
)
})
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new NonWritableChannelException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:NonWritableChannelExceptionTest.java
示例16: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationGolden",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "NonWritableChannelException",
args = {}
)
})
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new NonWritableChannelException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:NonWritableChannelExceptionTest.java
示例17: testSerializationCompatibility
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationGolden",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "ConnectionPendingException",
args = {}
)
})
public void testSerializationCompatibility() throws Exception {
SerializationTest.verifyGolden(this, new ConnectionPendingException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:ConnectionPendingExceptionTest.java
示例18: test_Serialization
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests java.util.InvalidPropertiesFormatException#SerializationTest()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
)
public void test_Serialization() throws Exception {
InvalidPropertiesFormatException ipfe = new InvalidPropertiesFormatException(
"Hey, this is InvalidPropertiesFormatException");
try {
SerializationTest.verifySelf(ipfe);
} catch (NotSerializableException e) {
// expected
}
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:19,代码来源:InvalidPropertiesFormatExceptionTest.java
示例19: testSerializationSelf
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "NotYetBoundException",
args = {}
)
})
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new NotYetBoundException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:NotYetBoundExceptionTest.java
示例20: testSerializationSelf
import org.apache.harmony.testframework.serialization.SerializationTest; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility.
*/
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "!SerializationSelf",
args = {}
),
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies serialization/deserialization compatibility.",
method = "NonReadableChannelException",
args = {}
)
})
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new NonReadableChannelException());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:NonReadableChannelExceptionTest.java
注:本文中的org.apache.harmony.testframework.serialization.SerializationTest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论