我需要帮助为我的班级编写Junit,为此编写Junit是否有任何价值,如果是,请帮助如何用示例编写。 提前谢谢。
my code is :
@ServerEndpoint(
value="/mysocketServer",
encoders = { MessageEncoder.class },
decoders = { MessageDecoder.class })
public class WebSocketService {
@OnOpen
public void onOpen(Session session) throws IOException, EncodeException, FTPWebSocketException {
session.getBasicRemote().sendObject(ackResponse);
}
@OnError
public void onError(Session session, Throwable t) {
logger.error("OnError ocurred for session: " + session.getId(), t);
}
@OnMessage
public void onMessage(FTPWebSocketRequest request, Session session) throws IOException, EncodeException, FTPWebSocketException {
session.getBasicRemote().sendObject(ackResponse);
}
@OnClose
public void onClose(CloseReason reason, Session session) throws FTPException {
new EndSessionOnMessageHandler().handleMessage(null, session);
}
}