@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");
} catch (WrongFPDUException e) {
} catch (Exception e) {
e.printStackTrace();
}
// Case 4
System.out.println("testFPDUReception : Case 4/6");
try {
fpdu.setType(EnumFPDU.RCONNECT);
cws.FPDUReception(fpdu);
fail("testFPDUReception : WrongFPDUException " +
"should have been raised");
} catch (WrongFPDUException e) {
} catch (Exception e) {
e.printStackTrace();
}
// Case 5
System.out.println("testFPDUReception : Case 5/6");
try {
fpdu.setType(EnumFPDU.RELCONF);
cws.FPDUReception(fpdu);
fail("testFPDUReception : WrongFPDUException " +
"should have been raised");
} catch (WrongFPDUException e) {
} catch (Exception e) {
e.printStackTrace();
}
// Case 6
System.out.println("testFPDUReception : Case 6/6");
try {
fpdu.setType(EnumFPDU.RELEASE);
cws.FPDUReception(fpdu);
fail("testFPDUReception : WrongFPDUException " +
"should have been raised");
} catch (WrongFPDUException e) {
} catch (Exception e) {