forked from john-bai/DesignPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSingletonTest.java
More file actions
37 lines (32 loc) · 782 Bytes
/
Copy pathSingletonTest.java
File metadata and controls
37 lines (32 loc) · 782 Bytes
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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package designpatterns;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author jtherrell
*/
public class SingletonTest {
/**
* Test of getInstance method, of class Singleton.
*/ @Test
public void testGetInstance() {
Singleton expResult = Singleton.getInstance();
Singleton result = Singleton.getInstance();
assertEquals(expResult, result);
}
/**
* Test of addToFoo method, of class Singleton.
*/ @Test
public void testAddToFoo() {
int num = 10;
Singleton instance = Singleton.getInstance();
int expResult = instance.getFoo() + num;
instance.addToFoo(num);
int result = instance.getFoo();
assertEquals(expResult, result);
}
}