-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
70 lines (61 loc) · 1.56 KB
/
test.java
File metadata and controls
70 lines (61 loc) · 1.56 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.example;
import java.util.*;
import java.io.IOException;
import com.example.util.*;
/**
* This class manages users
* @author Developer
*/
public class user_manager {
public String UserName;
public int AGE;
static final int maxSize=100;
// This method processes user data
public void Process_User_Data() {
if(UserName!=null)
{
doSomething();
}
switch(AGE){
case 18:
System.out.println("Adult");
break;
case 21:
System.out.println("Drinking age in US");
break;
default:
System.out.println("Other age");
break;
}
}
private void doSomething() {
// Create a new thread directly
new Thread(new Runnable() {
@Override
public void run() {
// This adds 1 to maxSize local variable
int maxSize = user_manager.maxSize + 1;
System.out.println(maxSize);
}
}).start();
}
public String getName() {
if (UserName == null)
return null;
else
return UserName;
}
class vehicle {
void move() { System.out.println("Moving"); }
}
class car extends vehicle {
void drive() { System.out.println("Driving"); }
}
@Test
void testPositive() {
assertEquals(10, someMethod(5));
}
private int someMethod(int value) {
return value * 2;
}
}