Thread: [Japi-cvs] SF.net SVN: japi: [32] trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.jav
Status: Beta
Brought to you by:
christianhujer
From: <z0...@us...> - 2006-04-10 21:21:14
|
Revision: 32 Author: z0ra Date: 2006-04-10 14:21:05 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=32&view=rev Log Message: ----------- Changed directory of test finance Added Paths: ----------- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java Added: trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java (rev 0) +++ trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:21:05 UTC (rev 32) @@ -0,0 +1,68 @@ +package net.sf.japi.util.finance; +/** Tests the capital finance class. + * Date: 09.04.2006 + * + */ + +import junit.framework.*; +import net.sf.japi.util.finance.InterestCalculator; + +public class InterestCalculatorTest extends TestCase { + InterestCalculator ic = new InterestCalculator(100, 15); + + public void testInterestCalculator() throws Exception { + //ic = new InterestCalculator(100, 15); + } + + /** Tests capital after 0, 1, 2 , 3 years. + * + * @throws Exception + */ + public void testCalculateCapital() throws Exception { + //ic = new InterestCalculator(100, 15); + + + /* first try it with invalid argument */ + try { + ic.calculateCapital(-1); + fail("Expected IllegalArgumentException."); + } catch (final IllegalArgumentException ignore) { + /* ignore */ + } + /* then use some different periods */ + assertEquals( (float)100.0 , ic.calculateCapital( 0 ) ); + assertEquals( (float)115.0 , ic.calculateCapital( 1 ) ); + assertEquals( (float)132.25 , ic.calculateCapital( 2 ) ); + assertEquals( (float)152.0875, ic.calculateCapital( 3 ) ); + } + + public void testGetCurrentCapital() throws Exception { + assertEquals( (float)100.00, ic.getCurrentCapital() ); + ic.calculateCapital(1); + assertEquals( (float)115.00, ic.getCurrentCapital() ); + } + + public void testSetCurrentCapital() throws Exception { + assertEquals( (float)100.00, ic.getCurrentCapital() ); + ic.calculateCapital(1); + assertEquals( (float)115.00, ic.getCurrentCapital() ); + ic.setCurrentCapital((float)100.00); + assertEquals( (float)100.00, ic.getCurrentCapital() ); + } + + public void testGetInterestRate() throws Exception { + assertEquals( (float)15, ic.getInterestRate() ); + } + + public void testSetInterestRate() throws Exception { + ic.setInterestRate(16); + assertEquals( (float)16, ic.getInterestRate() ); + } + + public void testResetCapital() throws Exception { + ic.calculateCapital(1); + assertEquals( (float)115, ic.getCurrentCapital() ); + ic.resetCapital(); + assertEquals( (float)100, ic.getCurrentCapital() ); + } +} \ No newline at end of file Property changes on: trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-10 21:29:08
|
Revision: 33 Author: christianhujer Date: 2006-04-10 14:28:57 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=33&view=rev Log Message: ----------- Fixed package statement Modified Paths: -------------- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java Modified: trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:21:05 UTC (rev 32) +++ trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:28:57 UTC (rev 33) @@ -1,10 +1,31 @@ -package net.sf.japi.util.finance; +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + + +package test.net.sf.japi.util.finance; /** Tests the capital finance class. * Date: 09.04.2006 - * + * */ -import junit.framework.*; +import junit.framework.TestCase; import net.sf.japi.util.finance.InterestCalculator; public class InterestCalculatorTest extends TestCase { @@ -15,7 +36,7 @@ } /** Tests capital after 0, 1, 2 , 3 years. - * + * * @throws Exception */ public void testCalculateCapital() throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-10 21:40:25
|
Revision: 34 Author: christianhujer Date: 2006-04-10 14:40:17 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=34&view=rev Log Message: ----------- Added example message Modified Paths: -------------- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java Modified: trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:28:57 UTC (rev 33) +++ trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:40:17 UTC (rev 34) @@ -51,7 +51,7 @@ /* ignore */ } /* then use some different periods */ - assertEquals( (float)100.0 , ic.calculateCapital( 0 ) ); + assertEquals("Capital after a time period of 0 must be the starting capital.", (float)100.0 , ic.calculateCapital( 0 ) ); assertEquals( (float)115.0 , ic.calculateCapital( 1 ) ); assertEquals( (float)132.25 , ic.calculateCapital( 2 ) ); assertEquals( (float)152.0875, ic.calculateCapital( 3 ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-10 21:41:54
|
Revision: 35 Author: christianhujer Date: 2006-04-10 14:41:48 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=35&view=rev Log Message: ----------- Fixed broken copyright. Modified Paths: -------------- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java Modified: trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:40:17 UTC (rev 34) +++ trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:41:48 UTC (rev 35) @@ -1,6 +1,6 @@ /* JAPI - (Yet another (hopefully) useful) Java API * - * Copyright (C) 2004-2006 Christian Hujer + * Copyright (C) 2006 Anja Heim * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-04-10 22:33:45
|
Revision: 37 Author: christianhujer Date: 2006-04-10 15:33:40 -0700 (Mon, 10 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=37&view=rev Log Message: ----------- Improved formatting. Modified Paths: -------------- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java Modified: trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java =================================================================== --- trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 21:43:26 UTC (rev 36) +++ trunk/src/test/net/sf/japi/util/finance/InterestCalculatorTest.java 2006-04-10 22:33:40 UTC (rev 37) @@ -18,17 +18,17 @@ * 02111-1307, USA. */ +package test.net.sf.japi.util.finance; -package test.net.sf.japi.util.finance; +import junit.framework.TestCase; +import net.sf.japi.util.finance.InterestCalculator; + /** Tests the capital finance class. * Date: 09.04.2006 * */ +public class InterestCalculatorTest extends TestCase { -import junit.framework.TestCase; -import net.sf.japi.util.finance.InterestCalculator; - -public class InterestCalculatorTest extends TestCase { InterestCalculator ic = new InterestCalculator(100, 15); public void testInterestCalculator() throws Exception { @@ -36,7 +36,6 @@ } /** Tests capital after 0, 1, 2 , 3 years. - * * @throws Exception */ public void testCalculateCapital() throws Exception { @@ -86,4 +85,5 @@ ic.resetCapital(); assertEquals( (float)100, ic.getCurrentCapital() ); } -} \ No newline at end of file + +} // class InterestCalculatorTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |