fix typoes, uncaught exceptions, started unit tests for ProcessManager

This commit is contained in:
Aidan Hahn 2019-05-22 23:51:37 -07:00
parent 7d90f1c87f
commit 9754f23fd8
No known key found for this signature in database
GPG key ID: 327711E983899316
4 changed files with 178 additions and 98 deletions

View 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);
}
}