1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.threads;
17
18 import junit.framework.Assert;
19
20 import org.junit.Test;
21
22 public class ThreadHandlerFactoryTest {
23
24 ThreadHandlerFactory factory = new ThreadHandlerFactory();
25
26 @Test
27 public void testGetDivideEvenly() {
28 int[] split = factory.getDivideEvenly(100, 7);
29
30 Assert.assertEquals(15, split[0]);
31 Assert.assertEquals(15, split[1]);
32 Assert.assertEquals(14, split[2]);
33 Assert.assertEquals(14, split[3]);
34 Assert.assertEquals(14, split[4]);
35 Assert.assertEquals(14, split[5]);
36 Assert.assertEquals(14, split[6]);
37 }
38
39 @Test
40 public void testGetThreadCount() {
41 int threads1 = factory.getThreadCount(1, 0, 0, 0);
42 int threads2 = factory.getThreadCount(50, 10, 21826, 0);
43 System.out.println(threads1);
44 System.out.println(threads2);
45 }
46
47 }