本文整理汇总了Java中org.testng.Assert.assertNotSame方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertNotSame方法的具体用法?Java Assert.assertNotSame怎么用?Java Assert.assertNotSame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.testng.Assert
的用法示例。
在下文中一共展示了Assert.assertNotSame方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBoolean
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testBoolean(){
ManyFieldBean bean = new ManyFieldBean();
//test true value
bean.setBooleanField(true);
mapNode.put(bean, null);
ManyFieldBean roundTripped = mapNode.get(bean.getKey(), null);
Assert.assertNotSame(roundTripped, bean);
Assert.assertEquals(roundTripped.getBooleanField(), bean.getBooleanField());
//test false value
bean.setBooleanField(false);
mapNode.put(bean, null);
ManyFieldBean roundTrippedFalse = mapNode.get(bean.getKey(), null);
Assert.assertNotSame(roundTrippedFalse, bean);
Assert.assertEquals(roundTrippedFalse.getBooleanField(), bean.getBooleanField());
}
示例2: hashCode
import org.testng.Assert; //导入方法依赖的package包/类
@Test(dataProvider = "seededPRNGPair")
public void hashCode(final Random rand1, final Random rand2) {
Assert.assertNotSame(rand2, rand1);
Assert.assertEquals(rand2, rand1);
Assert.assertEquals(rand2.hashCode(), rand1.hashCode());
for (int i = 0; i < 666; ++i) {
rand1.nextLong();
}
Assert.assertNotEquals(rand1, rand2);
Assert.assertNotEquals(rand2.hashCode(), rand1.hashCode());
for (int i = 0; i < 666; ++i) {
rand2.nextLong();
}
Assert.assertEquals(rand2, rand1);
Assert.assertEquals(rand2.hashCode(), rand1.hashCode());
}
示例3: serialize
import org.testng.Assert; //导入方法依赖的package包/类
@Test(dataProvider = "PRNG")
public void serialize(final Random rand1)
throws IOException, ClassNotFoundException
{
for (int i = 0; i < 12734; ++i) {
rand1.nextLong();
}
final Random rand2 = RandomTestBase.toSerialized(rand1);
Assert.assertNotSame(rand2, rand1);
Assert.assertTrue(
rand1.getClass().isAssignableFrom(rand2.getClass()),
String.format("Must be of type %s.", rand1.getClass())
);
for (int i = 0; i < 2489248; ++i) {
Assert.assertEquals(rand2.nextLong(), rand1.nextLong());
}
}
示例4: testSortRowsAndColumns1
import org.testng.Assert; //导入方法依赖的package包/类
@Test()
public void testSortRowsAndColumns1() throws Exception {
final DataFrame<LocalDate,String> frame = TestDataFrames.getQuotes("blk");
final DataFrame<LocalDate,String> sorted = frame.copy();
sorted.rows().sort(false, "Close");
sorted.cols().sort((col0, col1) -> col0.key().compareTo(col1.key()));
for (int i=0; i<frame.rowCount(); ++i) {
for (int j = 0; j<frame.colCount(); ++j) {
final LocalDate date = frame.rows().key(i);
final String column = frame.cols().key(j);
final Object left = frame.data().getValue(date, column);
final Object right = sorted.data().getValue(date, column);
Assert.assertEquals(left, right, "Values equal at (" + date + "," + column + ")");
Assert.assertNotSame(sorted.data().getValue(i,j), frame.data().getValue(i,j));
}
}
}
示例5: testByte
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testByte(){
ManyFieldBean bean = new ManyFieldBean();
bean.setByteField((byte)-57);
mapNode.put(bean, null);
ManyFieldBean roundTripped = mapNode.get(bean.getKey(), null);
Assert.assertNotSame(roundTripped, bean);
Assert.assertEquals(roundTripped.getByteField(), bean.getByteField());
}
示例6: testShort
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testShort(){
ManyFieldBean bean = new ManyFieldBean();
bean.setShortField((short)-57);
mapNode.put(bean, null);
ManyFieldBean roundTripped = mapNode.get(bean.getKey(), null);
Assert.assertNotSame(roundTripped, bean);
Assert.assertEquals(roundTripped.getShortField(), bean.getShortField());
}
示例7: testVarInt
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testVarInt(){
ManyFieldBean bean0 = new ManyFieldBean();
bean0.setVarIntField(0);
mapNode.put(bean0, null);
ManyFieldBean roundTripped0 = mapNode.get(bean0.getKey(), null);
Assert.assertNotSame(roundTripped0, bean0);
Assert.assertEquals(roundTripped0.getVarIntField(), bean0.getVarIntField());
//1234567
ManyFieldBean bean1234567 = new ManyFieldBean();
bean1234567.setVarIntField(1234567);
mapNode.put(bean1234567, null);
ManyFieldBean roundTripped1234567 = mapNode.get(bean1234567.getKey(), null);
Assert.assertNotSame(roundTripped1234567, bean1234567);
Assert.assertEquals(roundTripped1234567.getVarIntField(), bean1234567.getVarIntField());
//Integer.MAX_VALUE
ManyFieldBean beanMax = new ManyFieldBean();
beanMax.setVarIntField(Integer.MAX_VALUE);
mapNode.put(beanMax, null);
ManyFieldBean roundTrippedMax = mapNode.get(beanMax.getKey(), null);
Assert.assertNotSame(roundTrippedMax, beanMax);
Assert.assertEquals(roundTrippedMax.getVarIntField(), beanMax.getVarIntField());
}
示例8: testEquals
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testEquals(){
TestDatabean d1 = new TestDatabean("tri", "martolod", "yaouank");
TestDatabean d2 = new TestDatabean("lalala", "lalala", "la");
TestDatabean d3 = new TestDatabean("tri", "martolod", "yaouank");
Assert.assertEquals(d1, d3);
Assert.assertNotSame(d2, d3);
Assert.assertNotSame(d2, d1);
}
示例9: testNonGlobal
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public static void testNonGlobal() throws Exception {
final String name = "testNonGlobal";
final Symbol symbol1 = (Symbol)NativeSymbol.constructor(false, null, name);
final Symbol symbol2 = serializeRoundTrip(symbol1);
Assert.assertNotSame(symbol1, symbol2);
Assert.assertEquals(symbol2.getName(), name);
Assert.assertNotSame(symbol1, NativeSymbol._for(null, name));
}
示例10: parseAndCheckReset
import org.testng.Assert; //导入方法依赖的package包/类
private void parseAndCheckReset(boolean setFeature, boolean value) throws Exception {
// Expected result based on system property and feature
boolean resetExpected = setFeature && value;
// Indicates if system property is set
boolean spSet = runWithAllPerm(() -> System.getProperty(RESET_FEATURE)) != null;
// Dummy xml input for parser
String input = "<dummy>Test</dummy>";
// Check if system property is set only when feature setting is not requested
// and estimate if reset of symbol table is expected
if (!setFeature && spSet) {
resetExpected = runWithAllPerm(() -> Boolean.getBoolean(RESET_FEATURE));
}
// Create SAXParser and set feature if it is requested
SAXParserFactory spf = SAXParserFactory.newInstance();
if (setFeature) {
spf.setFeature(RESET_FEATURE, value);
}
SAXParser p = spf.newSAXParser();
// First parse iteration
p.parse(new InputSource(new StringReader(input)), new DefaultHandler());
// Get first symbol table reference
Object symTable1 = p.getProperty(SYMBOL_TABLE_PROPERTY);
// reset parser
p.reset();
// Second parse iteration
p.parse(new InputSource(new StringReader(input)), new DefaultHandler());
// Get second symbol table reference
Object symTable2 = p.getProperty(SYMBOL_TABLE_PROPERTY);
// Check symbol table references after two subsequent parse operations
if (resetExpected) {
Assert.assertNotSame(symTable1, symTable2, "Symbol table references");
} else {
Assert.assertSame(symTable1, symTable2, "Symbol table references");
}
}
示例11: equals
import org.testng.Assert; //导入方法依赖的package包/类
@Test(dataProvider = "seededPRNGPair")
public void equals(final Random rand1, final Random rand2) {
Assert.assertNotSame(rand2, rand1);
Assert.assertEquals(rand2, rand1);
for (int i = 0; i < 666; ++i) {
rand1.nextLong();
}
Assert.assertNotEquals(rand1, rand2);
for (int i = 0; i < 666; ++i) {
rand2.nextLong();
}
Assert.assertEquals(rand2, rand1);
}
示例12: testGetFieldDifferences
import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testGetFieldDifferences(){
StringFieldKey one = new StringFieldKey("one");
StringFieldKey two = new StringFieldKey("two");
BooleanFieldKey three = new BooleanFieldKey("three");
LongFieldKey four = new LongFieldKey("four");
DoubleFieldKey five = new DoubleFieldKey("five");
UInt31FieldKey six = new UInt31FieldKey("six");
Long sameRefLong = new Long(123456789000L);
List<Field<?>> left = Arrays.asList(
new StringField(one, "help"),
new StringField(two, "smite"),
new BooleanField(three, true),
new LongField(four, sameRefLong),
new DoubleField(five, 5e6));
// omitted six
List<Field<?>> right = Arrays.asList(
new StringField(one, "help"),
new StringField(two, "two"),
new BooleanField(three, null),
new LongField(four, sameRefLong),
// omitted five
new UInt31Field(six, 55));
Map<String, Pair<Field<?>, Field<?>>> diffs = getFieldDifferences(left, right);
Pair<Field<?>, Field<?>> test;
test = diffs.get(one.getName());
Assert.assertNull(test);
test = diffs.get(two.getName());
Assert.assertNotNull(test);
Assert.assertNotSame(test.getRight().getValue(), test.getLeft().getValue());
test = diffs.get(three.getName());
Assert.assertNotNull(test);
Assert.assertNull(test.getRight().getValue());
Assert.assertNotSame(test.getRight().getValue(), test.getLeft().getValue());
test = diffs.get(four.getName());
Assert.assertNull(test);
test = diffs.get(five.getName());
Assert.assertNotNull(test);
Assert.assertNull(test.getRight());
test = diffs.get(six.getName());
Assert.assertNotNull(test);
Assert.assertNull(test.getLeft());
test = diffs.get("this test does not exist");
Assert.assertNull(test);
}