-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChatClient_JUnitTest.java
49 lines (42 loc) · 1.21 KB
/
ChatClient_JUnitTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import org.junit.Test;
import java.io.IOException;
/**
* Course: 5DV167
* Written by: Thomas Sarlin
* @Author Thomas Sarlin
* @Version 1.0 13/10-2016
*/
public class ChatClient_JUnitTest {
/**
* Tests port out of range
* @throws IOException if port out of range
*/
@Test (expected = Exception.class)
public void invalidNumberOfArguments() throws IOException, InterruptedException {
new ChatClient("OOMP","ns","127.0.0.1",2202222);
}
/**
* Tests wrong serverType
*/
@Test (expected = Exception.class)
public void invalidServerType() throws IOException, InterruptedException {
new ChatClient("OOMP","qw","127.0.0.1",2222);
}
/**
* Tests invalid Identity
*/
@Test (expected = Exception.class)
public void invalidIdentity() throws IOException, InterruptedException {
String string = "a";
for(int i=0;i<300;i++)
string=string+"a";
new ChatClient(string,"cs","127.0.0.1",2222);
}
/**
* Tests invalid Server
*/
@Test (expected = Exception.class)
public void noValidServer() throws IOException, InterruptedException {
new ChatClient("Kalle","cs","127.0.0.1",2222);
}
}