public final class TestUtil extends Object
Class providing static utility methods to help in testing the
ServerModel
Modifier and Type | Method and Description |
---|---|
static void |
assertErrorToUser(int userId,
ServerErrorCode expected,
Broadcast actual)
This convenience method calls
assertErrorToUser(int, Set,
Broadcast) with a singleton set, for cases where only a single error
code is allowed by the specification. |
static void |
assertErrorToUser(int userId,
Set<ServerErrorCode> expected,
Broadcast actual)
When several error codes apply to an invalid command, your
ServerModel may send any one of them in reply. |
public static void assertErrorToUser(int userId, Set<ServerErrorCode> expected, Broadcast actual)
ServerModel
may send any one of them in reply. This helper
method checks whether one of some set of error codes was sent to the
user in the given broadcast; in addition, it verifies that no additional
responses were sent to any user in the broadcast.userId
- the user's IDexpected
- the set of allowed error codesactual
- the broadcast to check againstpublic static void assertErrorToUser(int userId, ServerErrorCode expected, Broadcast actual)
assertErrorToUser(int, Set,
Broadcast)
with a singleton set, for cases where only a single error
code is allowed by the specification.userId
- the user's IDexpected
- the allowed error codeactual
- the broadcast to check against