}
@Test
public void testFPDUReception() {
ConnectionWS cws = new ConnectionWS();
FPDUParameter parameter = new FPDUParameter("Bob", "Local");
parameter.setLocalConnectionId(1);
FPDU fpdu = new FPDU(EnumFPDU.CONNECT, parameter);
// Case 1
System.out.println("testFPDUReception : Case 1/6");
OutputConnectionWS ocws;
try {
ocws = cws.FPDUReception(fpdu);
assertEquals(EnumFPDU.ACONNECT, ocws.getFpdu().getType());
assertEquals("Bob", ocws.getFpdu().getParameter().getReceiver());
assertEquals("Local", ocws.getFpdu().getParameter().getSender());
} catch (Exception e) {
fail("testFPDUReception : No exception " +
"should have been raised");
}
// Case 2
System.out.println("testFPDUReception : Case 2/6");
try {
ocws = cws.FPDUReception(fpdu);
fail("testFPDUReception : ConnectionException " +
"should have been raised");
} catch (ConnectionException e) {
} catch (Exception e) {
e.printStackTrace();
}
// Case 3
System.out.println("testFPDUReception : Case 3/6");
parameter = new FPDUParameter("Alice", "Local");
fpdu = new FPDU(EnumFPDU.ACONNECT, parameter);
try {
ocws = cws.FPDUReception(fpdu);
fail("testFPDUReception : WrongFPDUException " +
"should have been raised");