當前位置: 首頁>>代碼示例>>Java>>正文


Java Assert.assertNotSame方法代碼示例

本文整理匯總了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());

}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:20,代碼來源:BaseManyFieldIntegrationTests.java

示例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());
}
 
開發者ID:jenetics,項目名稱:prngine,代碼行數:19,代碼來源:RandomTestBase.java

示例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());
	}

}
 
開發者ID:jenetics,項目名稱:prngine,代碼行數:21,代碼來源:RandomTestBase.java

示例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));
        }
    }
}
 
開發者ID:zavtech,項目名稱:morpheus-core,代碼行數:18,代碼來源:SortingTests.java

示例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());
}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:11,代碼來源:BaseManyFieldIntegrationTests.java

示例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());
}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:11,代碼來源:BaseManyFieldIntegrationTests.java

示例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());
}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:31,代碼來源:BaseManyFieldIntegrationTests.java

示例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);
}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:11,代碼來源:BaseManagedIndexIntegrationTests.java

示例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));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:JDK_8142924_Test.java

示例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");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:SymbolTableResetTest.java

示例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);
}
 
開發者ID:jenetics,項目名稱:prngine,代碼行數:16,代碼來源:RandomTestBase.java

示例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);

}
 
開發者ID:hotpads,項目名稱:datarouter,代碼行數:57,代碼來源:FieldSetTool.java


注:本文中的org.testng.Assert.assertNotSame方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。