当前位置: 首页>>代码示例>>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;未经允许,请勿转载。