本文整理汇总了Java中org.junit.jupiter.api.Tag类的典型用法代码示例。如果您正苦于以下问题:Java Tag类的具体用法?Java Tag怎么用?Java Tag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tag类属于org.junit.jupiter.api包,在下文中一共展示了Tag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNewSupplierNeg
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
@Tag("fast")
public void testNewSupplierNeg() 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(String.class, addressStr);
checkSupplier(2, connection, address, (Supplier<String>)supplier, "one", "two", "three");
adapter.close();
}
示例2: testNewConsumer1Neg
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
@Tag("fast")
public void testNewConsumer1Neg() 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(String.class, addressStr);
checkConsumer(2, connection, address, (Consumer<String>)consumer, "one", "two", "three");
adapter.close();
}
示例3: testNewConsumer2Neg
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void testNewConsumer2Neg() throws Exception {
String addressStr = "MyReadWriteAddress/0";
MockAddress address = new MockAddress(addressStr);
PlcConnectionAdapter adapter = new PlcConnectionAdapter(getMockConnection());
MockConnection connection = (MockConnection) adapter.getConnection();
Consumer<JsonObject> consumer;
Function<JsonObject,String> addressFn = t -> t.get("address").getAsString();
consumer = adapter.newConsumer(String.class, addressFn, t -> t.get("value").getAsString());
checkConsumerJson(2, connection, address, consumer, "one", "two", "three");
adapter.close();
}
示例4: encodeConnectionRequest
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeConnectionRequest() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ConnectionRequestTpdu tpdu = new ConnectionRequestTpdu((short)0x1, (short)(0x2), ProtocolClass.CLASS_0, Collections.emptyList(), buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 7, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x6, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.CONNECTION_REQUEST.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readShort() == (short)0x2, "Incorrect source reference code");
assertTrue(userData.readByte() == ProtocolClass.CLASS_0.getCode(), "Incorrect protocol class");
}
示例5: decodeConnectionRequest
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void decodeConnectionRequest() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Object> out = new ArrayList<>();
buf.writeByte(0x6); // header length
buf.writeByte(TpduCode.CONNECTION_REQUEST.getCode());
buf.writeShort(0x01); // destination reference
buf.writeShort(0x02); // source reference
buf.writeByte(ProtocolClass.CLASS_0.getCode());
IsoOnTcpMessage in = new IsoOnTcpMessage(buf);
isoTPProtocol.decode(ctx, in, out);
assertTrue(out.size() == 1, "Message not decoded");
ConnectionRequestTpdu requestTpdu = (ConnectionRequestTpdu) ((IsoTPMessage)out.get(0)).getTpdu();
assertTrue(requestTpdu.getTpduCode() == TpduCode.CONNECTION_REQUEST, "Message code not correct");
assertTrue(requestTpdu.getDestinationReference() == (short) 0x1, "Message destination reference not correct");
assertTrue(requestTpdu.getSourceReference() == (short) 0x2, "Message source reference not correct");
assertTrue(requestTpdu.getProtocolClass() == ProtocolClass.CLASS_0, "Message protocol class reference not correct");
assertTrue(requestTpdu.getParameters().isEmpty(), "Message contains paramaters");
}
示例6: encodeDisconnectionRequest
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeDisconnectionRequest() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
DisconnectRequestTpdu tpdu = new DisconnectRequestTpdu((short)0x1, (short)(0x2), DisconnectReason.NORMAL, Collections.emptyList(), buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 7, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x6, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.DISCONNECT_REQUEST.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readShort() == (short)0x2, "Incorrect source reference code");
assertTrue(userData.readByte() == DisconnectReason.NORMAL.getCode(), "Incorrect disconnect reason");
}
示例7: decodeDisconnectionRequest
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void decodeDisconnectionRequest() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Object> out = new ArrayList<>();
buf.writeByte(0x6); // header length
buf.writeByte(TpduCode.DISCONNECT_REQUEST.getCode());
buf.writeShort(0x01); // destination reference
buf.writeShort(0x02); // source reference
buf.writeByte(DisconnectReason.NORMAL.getCode());
IsoOnTcpMessage in = new IsoOnTcpMessage(buf);
isoTPProtocol.decode(ctx, in, out);
assertTrue(out.size() == 1, "Message not decoded");
DisconnectRequestTpdu requestTpdu = (DisconnectRequestTpdu) ((IsoTPMessage)out.get(0)).getTpdu();
assertTrue(requestTpdu.getTpduCode() == TpduCode.DISCONNECT_REQUEST, "Message code not correct");
assertTrue(requestTpdu.getDestinationReference() == (short) 0x1, "Message destination reference not correct");
assertTrue(requestTpdu.getSourceReference() == (short) 0x2, "Message source reference not correct");
assertTrue(requestTpdu.getDisconnectReason() == DisconnectReason.NORMAL, "Message disconnect reason not correct");
assertTrue(requestTpdu.getParameters().isEmpty(), "Message contains paramaters");
}
示例8: decodeData
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void decodeData() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Object> out = new ArrayList<>();
buf.writeByte(0x3); // header length
buf.writeByte(TpduCode.DATA.getCode());
buf.writeByte((byte) 0x1); // Tpdu code
IsoOnTcpMessage in = new IsoOnTcpMessage(buf);
isoTPProtocol.decode(ctx, in, out);
assertTrue(out.size() == 1, "Message not decoded");
DataTpdu requestTpdu = (DataTpdu) ((IsoTPMessage)out.get(0)).getTpdu();
assertTrue(requestTpdu.getTpduCode() == TpduCode.DATA, "Message code not correct");
assertTrue(requestTpdu.getTpduRef() == (short) 0x1, "Message Tpdu reference not correct");
assertTrue(!requestTpdu.isEot(), "Message EOT not correct");
assertTrue(requestTpdu.getParameters().isEmpty(), "Message contains paramaters");
}
示例9: encodeConnectionConfirm
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeConnectionConfirm() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ConnectionConfirmTpdu tpdu = new ConnectionConfirmTpdu((short)0x1, (short)(0x2), ProtocolClass.CLASS_1, Collections.emptyList(), buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 7, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x6, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.CONNECTION_CONFIRM.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readShort() == (short)0x2, "Incorrect source reference code");
assertTrue(userData.readByte() == ProtocolClass.CLASS_1.getCode(), "Incorrect protocol class");
}
示例10: decodeConnectionConfirm
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void decodeConnectionConfirm() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Object> out = new ArrayList<>();
buf.writeByte(0x6); // header length
buf.writeByte(TpduCode.CONNECTION_CONFIRM.getCode());
buf.writeShort(0x01); // destination reference
buf.writeShort(0x02); // source reference
buf.writeByte(ProtocolClass.CLASS_0.getCode());
IsoOnTcpMessage in = new IsoOnTcpMessage(buf);
isoTPProtocol.decode(ctx, in, out);
assertTrue(out.size() == 1, "Message not decoded");
ConnectionConfirmTpdu requestTpdu = (ConnectionConfirmTpdu) ((IsoTPMessage)out.get(0)).getTpdu();
assertTrue(requestTpdu.getTpduCode() == TpduCode.CONNECTION_CONFIRM, "Message code not correct");
assertTrue(requestTpdu.getDestinationReference() == (short) 0x1, "Message destination reference not correct");
assertTrue(requestTpdu.getSourceReference() == (short) 0x2, "Message source reference not correct");
assertTrue(requestTpdu.getProtocolClass() == ProtocolClass.CLASS_0, "Message protocol class reference not correct");
assertTrue(requestTpdu.getParameters().isEmpty(), "Message contains paramaters");
}
示例11: encodeDisconnectionConfirm
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeDisconnectionConfirm() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
DisconnectConfirmTpdu tpdu = new DisconnectConfirmTpdu((short)0x1, (short)(0x2), Collections.emptyList(), buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 6, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x5, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.DISCONNECT_CONFIRM.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readShort() == (short)0x2, "Incorrect source reference code");
}
示例12: encodeError
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeError() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ErrorTpdu tpdu = new ErrorTpdu((short)0x1, RejectCause.REASON_NOT_SPECIFIED, Collections.emptyList(), buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 5, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x4, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.TPDU_ERROR.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readByte() == RejectCause.REASON_NOT_SPECIFIED.getCode(), "Incorrect reject cause code");
}
示例13: encodeChecksumParameter
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeChecksumParameter() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Parameter> parmameters = new ArrayList<>();
ChecksumParameter checksumParameter = new ChecksumParameter((byte)0x77);
parmameters.add(checksumParameter);
ErrorTpdu tpdu = new ErrorTpdu((short)0x1, RejectCause.REASON_NOT_SPECIFIED, parmameters, buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 8, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x7, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.TPDU_ERROR.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readByte() == RejectCause.REASON_NOT_SPECIFIED.getCode(), "Incorrect reject cause code");
assertTrue(userData.readByte() == ParameterCode.CHECKSUM.getCode(), "Incorrect parameter code");
assertTrue(userData.readByte() == (byte)0x1, "Incorrect parameter length");
assertTrue(userData.readByte() == 0x77, "Incorrect checksum");
}
示例14: encodeSizeParameter
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void encodeSizeParameter() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Parameter> parmameters = new ArrayList<>();
TpduSizeParameter sizeParameter = new TpduSizeParameter(TpduSize.SIZE_512);
parmameters.add(sizeParameter);
ErrorTpdu tpdu = new ErrorTpdu((short)0x1, RejectCause.REASON_NOT_SPECIFIED, parmameters, buf);
ArrayList<Object> out = new ArrayList<>();
isoTPProtocol.encode(ctx, tpdu, out);
assertTrue(out.size() == 1, "Message not decoded");
ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();
assertTrue(userData.writerIndex() == 8, "Incorrect message length");
assertTrue(userData.readByte() == (byte)0x7, "Incorrect header length");
assertTrue(userData.readByte() == TpduCode.TPDU_ERROR.getCode(), "Incorrect Tpdu code");
assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
assertTrue(userData.readByte() == RejectCause.REASON_NOT_SPECIFIED.getCode(), "Incorrect reject cause code");
assertTrue(userData.readByte() == ParameterCode.TPDU_SIZE.getCode(), "Incorrect parameter code");
assertTrue(userData.readByte() == (byte)0x1, "Incorrect parameter length");
assertTrue(userData.readByte() == TpduSize.SIZE_512.getCode(), "Incorrect tdpu size");
}
示例15: decodeError
import org.junit.jupiter.api.Tag; //导入依赖的package包/类
@Test
@Tag("fast")
public void decodeError() throws Exception {
ChannelHandlerContext ctx = new MockChannelHandlerContext();
ByteBuf buf = Unpooled.buffer();
ArrayList<Object> out = new ArrayList<>();
buf.writeByte(0x4); // header length
buf.writeByte(TpduCode.TPDU_ERROR.getCode());
buf.writeShort(0x01); // destination reference
buf.writeByte(RejectCause.REASON_NOT_SPECIFIED.getCode());
IsoOnTcpMessage in = new IsoOnTcpMessage(buf);
isoTPProtocol.decode(ctx, in, out);
assertTrue(out.size() == 1, "Message not decoded");
ErrorTpdu errorTpdu = (ErrorTpdu) ((IsoTPMessage)out.get(0)).getTpdu();
assertTrue(errorTpdu.getTpduCode() == TpduCode.TPDU_ERROR, "Message code not correct");
assertTrue(errorTpdu.getDestinationReference() == (short) 0x1, "Message destination reference not correct");
assertTrue(errorTpdu.getRejectCause() == RejectCause.REASON_NOT_SPECIFIED, "Message reject cause not correct");
assertTrue(errorTpdu.getParameters().isEmpty(), "Message contains paramaters");
}