本文整理匯總了Java中org.junit.jupiter.api.Assertions.assertSame方法的典型用法代碼示例。如果您正苦於以下問題:Java Assertions.assertSame方法的具體用法?Java Assertions.assertSame怎麽用?Java Assertions.assertSame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.junit.jupiter.api.Assertions
的用法示例。
在下文中一共展示了Assertions.assertSame方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testCtor1
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
@Tag("fast")
public void testCtor1() throws Exception {
MockConnection mockConnection = getMockConnection();
PlcConnectionAdapter adapter = new PlcConnectionAdapter(mockConnection);
Assertions.assertSame(mockConnection, adapter.getConnection());
// and again... multiple adapter.getConnection() returns the same
Assertions.assertSame(mockConnection, adapter.getConnection());
adapter.close();
}
示例2: 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();
}
示例3: ofIntIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofIntIsSingleton() {
final FilterParser<Integer> filterParser1 = FilterParser.ofInt();
final FilterParser<Integer> filterParser2 = FilterParser.ofInt();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例4: ofDateIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofDateIsSingleton() {
final FilterParser<LocalDate> filterParser1 = FilterParser.ofDate();
final FilterParser<LocalDate> filterParser2 = FilterParser.ofDate();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例5: ofTimeIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofTimeIsSingleton() {
final FilterParser<LocalTime> filterParser1 = FilterParser.ofTime();
final FilterParser<LocalTime> filterParser2 = FilterParser.ofTime();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例6: ofDateTimeIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofDateTimeIsSingleton() {
final FilterParser<LocalDateTime> filterParser1 = FilterParser.ofDateTime();
final FilterParser<LocalDateTime> filterParser2 = FilterParser.ofDateTime();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例7: ofIdentityIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofIdentityIsSingleton() {
final FilterParser<String> filterParser1 = FilterParser.ofIdentity();
final FilterParser<String> filterParser2 = FilterParser.ofIdentity();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例8: ofByteIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofByteIsSingleton() {
final FilterParser<Byte> filterParser1 = FilterParser.ofByte();
final FilterParser<Byte> filterParser2 = FilterParser.ofByte();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例9: ofIntIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofIntIsSingleton() {
final FilterMultipleValueParser<Integer> filterParser1 = FilterMultipleValueParser.ofInt();
final FilterMultipleValueParser<Integer> filterParser2 = FilterMultipleValueParser.ofInt();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例10: ofDateIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofDateIsSingleton() {
final FilterMultipleValueParser<LocalDate> filterParser1 = FilterMultipleValueParser.ofDate();
final FilterMultipleValueParser<LocalDate> filterParser2 = FilterMultipleValueParser.ofDate();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例11: ofTimeIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofTimeIsSingleton() {
final FilterMultipleValueParser<LocalTime> filterParser1 = FilterMultipleValueParser.ofTime();
final FilterMultipleValueParser<LocalTime> filterParser2 = FilterMultipleValueParser.ofTime();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例12: ofDateTimeIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofDateTimeIsSingleton() {
final FilterMultipleValueParser<LocalDateTime> filterParser1 = FilterMultipleValueParser.ofDateTime();
final FilterMultipleValueParser<LocalDateTime> filterParser2 = FilterMultipleValueParser.ofDateTime();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例13: ofIdentityIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofIdentityIsSingleton() {
final FilterMultipleValueParser<String> filterParser1 = FilterMultipleValueParser.ofIdentity();
final FilterMultipleValueParser<String> filterParser2 = FilterMultipleValueParser.ofIdentity();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例14: ofByteIsSingleton
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
void ofByteIsSingleton() {
final FilterMultipleValueParser<Byte> filterParser1 = FilterMultipleValueParser.ofByte();
final FilterMultipleValueParser<Byte> filterParser2 = FilterMultipleValueParser.ofByte();
Assertions.assertNotNull(filterParser1);
Assertions.assertSame(filterParser1, filterParser2);
}
示例15: testNewPlcReadRequest
import org.junit.jupiter.api.Assertions; //導入方法依賴的package包/類
@Test
@Tag("fast")
public void testNewPlcReadRequest() throws Exception {
String addressStr = "MyReadWriteAddress/0";
MockAddress address = new MockAddress(addressStr);
PlcConnectionAdapter adapter = new PlcConnectionAdapter(getMockConnection());
MockConnection connection = (MockConnection) adapter.getConnection();
PlcReadRequest request;
request = PlcConnectionAdapter.newPlcReadRequest(Boolean.class, address);
ReadRequestItem requestItem = request.getReadRequestItems().get(0);
Class dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == Boolean.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, true);
checkRead(connection, request, false);
request = PlcConnectionAdapter.newPlcReadRequest(Byte.class, address);
requestItem = request.getReadRequestItems().get(0);
dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == Byte.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, (byte)0x13);
checkRead(connection, request, (byte)0x23);
request = PlcConnectionAdapter.newPlcReadRequest(Short.class, address);
requestItem = request.getReadRequestItems().get(0);
dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == Short.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, (short)13);
checkRead(connection, request, (short)23);
request = PlcConnectionAdapter.newPlcReadRequest(Integer.class, address);
requestItem = request.getReadRequestItems().get(0);
dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == Integer.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, 33);
checkRead(connection, request, -133);
request = PlcConnectionAdapter.newPlcReadRequest(Float.class, address);
requestItem = request.getReadRequestItems().get(0);
dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == Float.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, 43.5f);
checkRead(connection, request, -143.5f);
request = PlcConnectionAdapter.newPlcReadRequest(String.class, address);
requestItem = request.getReadRequestItems().get(0);
dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == String.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, "ReadySetGo");
checkRead(connection, request, "OneMoreTime");
request = PlcConnectionAdapter.newPlcReadRequest(Calendar.class, address);
requestItem = request.getReadRequestItems().get(0);
dataType = requestItem.getDatatype();
Assertions.assertTrue(dataType == Calendar.class, "class:"+request.getClass());
Assertions.assertSame(address, requestItem.getAddress());
checkRead(connection, request, Calendar.getInstance());
adapter.close();
}