當前位置: 首頁>>代碼示例>>Java>>正文


Java ErrorMessage類代碼示例

本文整理匯總了Java中net.dlogic.kryonet.common.constant.ErrorMessage的典型用法代碼示例。如果您正苦於以下問題:Java ErrorMessage類的具體用法?Java ErrorMessage怎麽用?Java ErrorMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ErrorMessage類屬於net.dlogic.kryonet.common.constant包,在下文中一共展示了ErrorMessage類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testAddUserToRoom_ThrowsRoomManagerException_RoomIsFull

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
@Test
public void testAddUserToRoom_ThrowsRoomManagerException_RoomIsFull() throws RoomManagerException {
	exception.expect(RoomManagerException.class);
	exception.expectMessage(ErrorMessage.ROOM_IS_FULL);
	User user = new User();
	user.id = 1;
	user.username = "mike";
	manager.addUserToRoom(user, "Test");
	User user2 = new User();
	user2.id = 2;
	user2.username = "angelo";
	manager.addUserToRoom(user2, "Test");
	User user3 = new User();
	user3.id = 3;
	user3.username = "mack";
	manager.addUserToRoom(user3, "Test");
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:18,代碼來源:RoomManagerTest.java

示例2: addUserToRoom

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
public void addUserToRoom(User user, String roomName) throws RoomManagerException {
	if (!map.containsKey(roomName)) {
		throw new RoomManagerException(ErrorMessage.ROOM_DOESNT_EXIST);
	}
	Room room = map.get(roomName);
	if (room.isFull()) {
		throw new RoomManagerException(ErrorMessage.ROOM_IS_FULL);
	}
	if (room.users.containsKey(user.id)) {
		throw new RoomManagerException(ErrorMessage.USER_ALREADY_IN_ROOM);
	}
	room.users.put(user.id, user);
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:14,代碼來源:RoomManager.java

示例3: removeUserFromRoom

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
public void removeUserFromRoom(User user, String roomName) throws RoomManagerException {
	if (!map.containsKey(roomName)) {
		throw new RoomManagerException(ErrorMessage.ROOM_DOESNT_EXIST);
	}
	Room room = map.get(roomName);
	if (!room.users.containsKey(user.id)) {
		throw new RoomManagerException(ErrorMessage.USER_NOT_IN_ROOM);
	}
	room.users.remove(user.id);
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:11,代碼來源:RoomManager.java

示例4: testAddUserToRoom_ThrowsRoomManagerException_RoomDoesntExist

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
@Test
public void testAddUserToRoom_ThrowsRoomManagerException_RoomDoesntExist() throws RoomManagerException {
	exception.expect(RoomManagerException.class);
	exception.expectMessage(ErrorMessage.ROOM_DOESNT_EXIST);
	User user = new User();
	user.id = 1;
	user.username = "mike";
	manager.addUserToRoom(user, "Ghost");
	assertTrue(manager.map.get("Test").users.containsKey(user.id));
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:11,代碼來源:RoomManagerTest.java

示例5: testAddUserToRoom_ThrowsRoomManagerException_UserAlreadyInRoom

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
@Test
public void testAddUserToRoom_ThrowsRoomManagerException_UserAlreadyInRoom() throws RoomManagerException {
	exception.expect(RoomManagerException.class);
	exception.expectMessage(ErrorMessage.USER_ALREADY_IN_ROOM);
	User user = new User();
	user.id = 1;
	user.username = "mike";
	manager.addUserToRoom(user, "Test");
	manager.addUserToRoom(user, "Test");
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:11,代碼來源:RoomManagerTest.java

示例6: testRemoveUserFromRoom_ThrowsRoomManagerException_RoomDoesntExist

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
@Test
public void testRemoveUserFromRoom_ThrowsRoomManagerException_RoomDoesntExist() throws RoomManagerException {
	exception.expect(RoomManagerException.class);
	exception.expectMessage(ErrorMessage.ROOM_DOESNT_EXIST);
	User user = new User();
	user.id = 1;
	user.username = "mike";
	manager.removeUserFromRoom(user, "Ghost");
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:10,代碼來源:RoomManagerTest.java

示例7: testRemoveUserFromRoom_ThrowsRoomManagerException_UserNotInRoom

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
@Test
public void testRemoveUserFromRoom_ThrowsRoomManagerException_UserNotInRoom() throws RoomManagerException {
	exception.expect(RoomManagerException.class);
	exception.expectMessage(ErrorMessage.USER_NOT_IN_ROOM);
	User user = new User();
	user.id = 1;
	user.username = "mike";
	manager.removeUserFromRoom(user, "Test2");
}
 
開發者ID:macalimlim,項目名稱:kryonet-common,代碼行數:10,代碼來源:RoomManagerTest.java

示例8: initialize

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
public static void initialize(int writeBufferSize, int objectBufferSize) throws IOException, KryonetClientException {
	Log.debug("KryonetClientInstance.initialize(" + writeBufferSize + ", " + objectBufferSize + ")");
	if (client != null) {
		throw new KryonetClientException(ErrorMessage.CLIENT_ALREADY_INITIALIZED);
	}
	client = new KryonetClient(writeBufferSize, objectBufferSize);
}
 
開發者ID:macalimlim,項目名稱:kryonet-client,代碼行數:8,代碼來源:KryonetClientInstance.java

示例9: getInstance

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
public static KryonetClient getInstance() throws KryonetClientException {
	Log.debug("KryonetClientInstance.getInstance()");
	if (client == null) {
		throw new KryonetClientException(ErrorMessage.CLIENT_NOT_INITIALIZED);
	}
	return client;
}
 
開發者ID:macalimlim,項目名稱:kryonet-client,代碼行數:8,代碼來源:KryonetClientInstance.java

示例10: onLogin

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
@Override
public void onLogin(String username, String password) throws LoginException {
	Log.info("MyUserEventHandler.onLogin(" + username + ", " + password + ")");
	if (username.equalsIgnoreCase("mike") && password.equalsIgnoreCase("mike")) {
		Log.info("Yaaay!");
	} else {
		throw new LoginException(ErrorMessage.INVALID_USERNAME_ANDOR_PASSWORD);
	}
}
 
開發者ID:macalimlim,項目名稱:kryonet-server,代碼行數:10,代碼來源:MyUserEventHandler.java

示例11: initialize

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
public static void initialize(int writeBufferSize, int objectBufferSize) throws IOException, KryonetServerException {
	Log.debug("KryonetServerInstance.initialize(" + writeBufferSize + ", " + objectBufferSize + ")");
	if (server != null) {
		throw new KryonetServerException(ErrorMessage.SERVER_ALREADY_INITIALIZED);
	}
	server = new KryonetServer(writeBufferSize, objectBufferSize);
}
 
開發者ID:macalimlim,項目名稱:kryonet-server,代碼行數:8,代碼來源:KryonetServerInstance.java

示例12: getInstance

import net.dlogic.kryonet.common.constant.ErrorMessage; //導入依賴的package包/類
public static KryonetServer getInstance() throws KryonetServerException {
	//Log.debug("KryonetServerInstance.getInstance()");
	if (server == null) {
		throw new KryonetServerException(ErrorMessage.SERVER_NOT_INITIALIZED);
	}
	return server;
}
 
開發者ID:macalimlim,項目名稱:kryonet-server,代碼行數:8,代碼來源:KryonetServerInstance.java


注:本文中的net.dlogic.kryonet.common.constant.ErrorMessage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。