1 43 44 package org.jfree.date.junit; 45 46 import junit.framework.Test; 47 import junit.framework.TestCase; 48 import junit.framework.TestSuite; 49 50 import org.jfree.date.MonthConstants; 51 import org.jfree.date.SerialDate; 52 import org.jfree.date.SerialDateUtilities; 53 54 58 public class SerialDateUtilitiesTests extends TestCase { 59 60 65 public SerialDateUtilitiesTests(final String name) { 66 super(name); 67 } 68 69 74 public static Test suite() { 75 return new TestSuite(SerialDateUtilitiesTests.class); 76 } 77 78 81 public void testDayCountActual() { 82 final SerialDate d1 = SerialDate.createInstance(1, MonthConstants.APRIL, 2002); 83 final SerialDate d2 = SerialDate.createInstance(2, MonthConstants.APRIL, 2002); 84 final int count = SerialDateUtilities.dayCountActual(d1, d2); 85 assertEquals(1, count); 86 } 87 88 91 public void testDayCount30() { 92 final SerialDate d1 = SerialDate.createInstance(1, MonthConstants.APRIL, 2002); 93 final SerialDate d2 = SerialDate.createInstance(2, MonthConstants.APRIL, 2002); 94 final int count = SerialDateUtilities.dayCount30(d1, d2); 95 assertEquals(1, count); 96 } 97 98 101 public void testDayCount30ISDA() { 102 final SerialDate d1 = SerialDate.createInstance(1, MonthConstants.APRIL, 2002); 103 final SerialDate d2 = SerialDate.createInstance(2, MonthConstants.APRIL, 2002); 104 final int count = SerialDateUtilities.dayCount30ISDA(d1, d2); 105 assertEquals(1, count); 106 } 107 108 111 public void testDayCount30PSA() { 112 final SerialDate d1 = SerialDate.createInstance(1, MonthConstants.APRIL, 2002); 113 final SerialDate d2 = SerialDate.createInstance(2, MonthConstants.APRIL, 2002); 114 final int count = SerialDateUtilities.dayCount30PSA(d1, d2); 115 assertEquals(1, count); 116 } 117 118 121 public void testDayCount3030E() { 122 final SerialDate d1 = SerialDate.createInstance(1, MonthConstants.APRIL, 2002); 123 final SerialDate d2 = SerialDate.createInstance(2, MonthConstants.APRIL, 2002); 124 final int count = SerialDateUtilities.dayCount30E(d1, d2); 125 assertEquals(1, count); 126 } 127 128 } 129 | Popular Tags |