fix typoes, uncaught exceptions, started unit tests for ProcessManager
This commit is contained in:
parent
7d90f1c87f
commit
9754f23fd8
4 changed files with 178 additions and 98 deletions
49
src/test/java/JobServ/ProcessManagerTest.java
Normal file
49
src/test/java/JobServ/ProcessManagerTest.java
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* ProcessManagerTest
|
||||
*
|
||||
* v1.0
|
||||
*
|
||||
* May 22, 2019
|
||||
*/
|
||||
|
||||
package JobServ;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
/*
|
||||
* ProcessManagerTest
|
||||
* Class that performs positive and negative unit tests
|
||||
* of every public method in ProcessManager. This not
|
||||
* only unit tests ProcessManager but also integration
|
||||
* tests it with ProcessController.
|
||||
*/
|
||||
public class ProcessManagerTest {
|
||||
ProcessManager manager;
|
||||
|
||||
/*
|
||||
* ProcessManagerTest constructor
|
||||
* initializes the process manager
|
||||
*/
|
||||
public ProcessManagerTest() {
|
||||
manager = new ProcessManager();
|
||||
}
|
||||
|
||||
/*
|
||||
* addProcessTest()
|
||||
* positive unit test for newProcess
|
||||
*/
|
||||
@Test
|
||||
public void addProcessesTest() {
|
||||
int pid1 = manager.newProcess("ping google");
|
||||
assertEquals(0, pid1);
|
||||
|
||||
int pid2 = manager.newProcess("ping google");
|
||||
assertEquals(1, pid2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue