### Question:
AbstractSerialPort implements IConnectionInterface { public SerialPortParameters getPortParameters() { if (parameters != null) return parameters; return new SerialPortParameters(baudRate, DEFAULT_DATA_BITS, DEFAULT_STOP_BITS, DEFAULT_PARITY, DEFAULT_FLOW_CONTROL); } protected  AbstractSerialPort(String port, SerialPortParameters parameters); protected  AbstractSerialPort(String port, int baudRate); protected  AbstractSerialPort(String port, int baudRate, int receiveTimeout); protected  AbstractSerialPort(String port, SerialPortParameters parameters, int receiveTimeout); @Override boolean isOpen(); String getPort(); abstract void setDTR(boolean state); abstract void setRTS(boolean state); abstract boolean isCTS(); abstract boolean isDSR(); abstract boolean isCD(); boolean isHardwareFlowControl(); void setPortParameters(int baudRate, int dataBits, int stopBits, int parity, int flowControl); void setPortParameters(SerialPortParameters parameters); abstract void setBreak(boolean enabled); abstract void sendBreak(int duration); abstract void setReadTimeout(int timeout); abstract int getReadTimeout(); void purge(); void flush(); @Override void writeData(byte[] data); @Override void writeData(byte[] data, int offset, int length); @Override int readData(byte[] data); @Override int readData(byte[] data, int offset, int length); @Override ConnectionType getConnectionType(); SerialPortParameters getPortParameters(); int getReceiveTimeout(); @Override String toString(); static final int DEFAULT_PORT_TIMEOUT; static final int DEFAULT_DATA_BITS; static final int DEFAULT_STOP_BITS; static final int DEFAULT_PARITY; static final int DEFAULT_FLOW_CONTROL; }### Answer:
@Test public final void testGetPortParametersDefault() { TestAbstractSerialPort port = Mockito.spy(new TestAbstractSerialPort("COM1", 9600)); SerialPortParameters expected = new SerialPortParameters(9600, AbstractSerialPort.DEFAULT_DATA_BITS, AbstractSerialPort.DEFAULT_STOP_BITS, AbstractSerialPort.DEFAULT_PARITY, AbstractSerialPort.DEFAULT_FLOW_CONTROL); SerialPortParameters result = port.getPortParameters(); assertThat(result, is(equalTo(expected))); }
@Test public final void testGetPortParameters() { SerialPortParameters expected = new SerialPortParameters(9600, 7, 2, 1, 3); TestAbstractSerialPort port = Mockito.spy(new TestAbstractSerialPort("COM1", expected)); SerialPortParameters result = port.getPortParameters(); assertThat(result, is(equalTo(expected))); }