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


Java Assertions.assertNotSame方法代碼示例

本文整理匯總了Java中org.junit.jupiter.api.Assertions.assertNotSame方法的典型用法代碼示例。如果您正苦於以下問題:Java Assertions.assertNotSame方法的具體用法?Java Assertions.assertNotSame怎麽用?Java Assertions.assertNotSame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.jupiter.api.Assertions的用法示例。


在下文中一共展示了Assertions.assertNotSame方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCtor2

import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
@Tag("fast")
public void testCtor2() throws Exception {
  MockConnection mockConnection = getMockConnection();
  PlcConnectionAdapter adapter = new PlcConnectionAdapter(mockConnection.getUrl());
  MockConnection mockConnection2 = (MockConnection) adapter.getConnection();
  Assertions.assertNotSame(mockConnection, mockConnection2);
  Assertions.assertSame(mockConnection.getUrl(), mockConnection2.getUrl());
  // and again... multiple adapter.getConnection() returns the same
  Assertions.assertSame(mockConnection2, adapter.getConnection());
  adapter.close();
}
 
開發者ID:apache,項目名稱:incubator-plc4x,代碼行數:13,代碼來源:PlcConnectionAdapterTest.java

示例2: testNewSupplier

import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
@Tag("fast")
public void testNewSupplier() throws Exception {
  String addressStr = "MyReadWriteAddress/0";
  MockAddress address = new MockAddress(addressStr);
  PlcConnectionAdapter adapter = new PlcConnectionAdapter(getMockConnection());
  MockConnection connection = (MockConnection) adapter.getConnection();

  Supplier<?> supplier;
  
  supplier = adapter.newSupplier(Boolean.class, addressStr);
  Assertions.assertNotSame(supplier, adapter.newSupplier(Boolean.class, addressStr));
  checkSupplier(connection, address, (Supplier<Boolean>)supplier, true, false);
  
  supplier = adapter.newSupplier(Byte.class, addressStr);
  checkSupplier(connection, address, (Supplier<Byte>)supplier, (byte)0x1, (byte)0x2, (byte)0x3);
  
  supplier = adapter.newSupplier(Short.class, addressStr);
  checkSupplier(connection, address, (Supplier<Short>)supplier, (short)1, (short)2, (short)3);

  supplier = adapter.newSupplier(Integer.class, addressStr);
  checkSupplier(connection, address, (Supplier<Integer>)supplier, 1000, 1001, 1002);
  
  supplier = adapter.newSupplier(Float.class, addressStr);
  checkSupplier(connection, address, (Supplier<Float>)supplier, 1000.5f, 1001.5f, 1002.5f);
  
  supplier = adapter.newSupplier(String.class, addressStr);
  checkSupplier(connection, address, (Supplier<String>)supplier, "one", "two", "three");
  
  adapter.close();
}
 
開發者ID:apache,項目名稱:incubator-plc4x,代碼行數:33,代碼來源:PlcConnectionAdapterTest.java

示例3: testNewConsumer1

import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
@Tag("fast")
public void testNewConsumer1() throws Exception {
  String addressStr = "MyReadWriteAddress/0";
  MockAddress address = new MockAddress(addressStr);
  PlcConnectionAdapter adapter = new PlcConnectionAdapter(getMockConnection());
  MockConnection connection = (MockConnection) adapter.getConnection();

  Consumer<?> consumer;
  
  consumer = adapter.newConsumer(Boolean.class, addressStr);
  Assertions.assertNotSame(consumer, adapter.newConsumer(Boolean.class, addressStr));
  checkConsumer(connection, address, consumer, true, false);
  
  consumer = adapter.newConsumer(Byte.class, addressStr);
  checkConsumer(connection, address, consumer, (byte)0x1, (byte)0x2, (byte)0x3);
  
  consumer = adapter.newConsumer(Short.class, addressStr);
  checkConsumer(connection, address, consumer, (short)1, (short)2, (short)3);

  consumer = adapter.newConsumer(Integer.class, addressStr);
  checkConsumer(connection, address, consumer, 1000, 1001, 1002);
  
  consumer = adapter.newConsumer(Float.class, addressStr);
  checkConsumer(connection, address, consumer, 1000.5f, 1001.5f, 1002.5f);
  
  consumer = adapter.newConsumer(String.class, addressStr);
  checkConsumer(connection, address, consumer, "one", "two", "three");
  
  adapter.close();
}
 
開發者ID:apache,項目名稱:incubator-plc4x,代碼行數:32,代碼來源:PlcConnectionAdapterTest.java

示例4: getField

import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void getField() {
    final SortValue ofInt = SortValue.of(intField);

    Assertions.assertNotNull(ofInt.getField());
    Assertions.assertNotSame(Optional.empty(), ofInt.getField());
    Assertions.assertEquals(Optional.empty(), ofInt.getTableField());
    Assertions.assertNotNull(ofInt.getField().get());
    Assertions.assertEquals(intField, ofInt.getField().get());
}
 
開發者ID:Blackdread,項目名稱:filter-sort-jooq-api,代碼行數:11,代碼來源:SortValueTest.java


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