Re: svn commit: r600881 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r600881 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java

Jacques Le Roux
Administrator
Scott,

A quick question about you last post around tests. Should we merge them with release4.0 ?

Jacques

De : <[hidden email]>

> Author: lektran
> Date: Tue Dec  4 03:21:13 2007
> New Revision: 600881
>
> URL: http://svn.apache.org/viewvc?rev=600881&view=rev
> Log:
> Couple of fixes to FinAccountTests:
> 1.  There's no such type as a BALANCE_ACCOUNT so I switched to a BANK_ACCOUNT
> 2.  You can't use instance variables in a test because each case is run as a new object
> The test now passes
>
> Modified:
>     ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
>
> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java?rev=600881&r1=600880&r2=600881&view=diff

> ==============================================================================
> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java (original)
> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java Tue Dec  4 03:21:13 2007
> @@ -24,6 +24,7 @@
>  import org.ofbiz.entity.GenericValue;
>  import org.ofbiz.service.GenericDispatcher;
>  import org.ofbiz.service.LocalDispatcher;
> +import org.ofbiz.service.ModelService;
>  import org.ofbiz.base.util.UtilMisc;
>
>  import java.util.Map;
> @@ -37,8 +38,6 @@
>
>      protected LocalDispatcher dispatcher = null;
>      protected GenericValue userLogin = null;
> -    protected String finAccountId = null;
> -    protected double balance = 0.00;
>
>      public FinAccountTests(String name) {
>          super(name);
> @@ -55,32 +54,32 @@
>
>      public void testCreateFinAccount() throws Exception {
>          Map ctx = FastMap.newInstance();
> +        ctx.put("finAccountId", "TESTACCOUNT1");
>          ctx.put("finAccountName", "Test Financial Account");
> -        ctx.put("finAccountTypeId", "BALANCE_ACCOUNT");
> +        ctx.put("finAccountTypeId", "BANK_ACCOUNT");
>          ctx.put("userLogin", userLogin);
>          Map resp = dispatcher.runSync("createFinAccount", ctx);
> -        finAccountId = (String) resp.get("finAccountId");
> -        assertNotNull(finAccountId);
> +        assertEquals("Service result success", ModelService.RESPOND_SUCCESS, resp.get(ModelService.RESPONSE_MESSAGE));
>      }
>
>      public void testDeposit() throws Exception {
>          Map ctx = FastMap.newInstance();
> -        ctx.put("finAccountId", finAccountId);
> +        ctx.put("finAccountId", "TESTACCOUNT1");
>          ctx.put("amount", new Double(100.00));
>          ctx.put("userLogin", userLogin);
>          Map resp = dispatcher.runSync("finAccountDeposit", ctx);
> -        balance = ((Double) resp.get("balance")).doubleValue();
> +        Double balance = ((Double) resp.get("balance")).doubleValue();
>          assertEquals(balance, 100.00, 0.0);
>      }
>
>      public void testWithdraw() throws Exception {
>          Map ctx = FastMap.newInstance();
> -        ctx.put("finAccountId", finAccountId);
> +        ctx.put("finAccountId", "TESTACCOUNT1");
>          ctx.put("amount", new Double(50.00));
>          ctx.put("userLogin", userLogin);
>          Map resp = dispatcher.runSync("finAccountWithdraw", ctx);
>          Double previousBalance = (Double) resp.get("previousBalance");
> -        balance = ((Double) resp.get("balance")).doubleValue();
> +        Double balance = ((Double) resp.get("balance")).doubleValue();
>          assertEquals((balance + 50.00), previousBalance.doubleValue(), 0.0);
>      }
>  }
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r600881 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java

Scott Gray
Hi Jacques

I don't see why not, they were all bugfixes.

Regards
Scott

On 05/12/2007, Jacques Le Roux <[hidden email]> wrote:

>
> Scott,
>
> A quick question about you last post around tests. Should we merge them
> with release4.0 ?
>
> Jacques
>
> De : <[hidden email]>
> > Author: lektran
> > Date: Tue Dec  4 03:21:13 2007
> > New Revision: 600881
> >
> > URL: http://svn.apache.org/viewvc?rev=600881&view=rev
> > Log:
> > Couple of fixes to FinAccountTests:
> > 1.  There's no such type as a BALANCE_ACCOUNT so I switched to a
> BANK_ACCOUNT
> > 2.  You can't use instance variables in a test because each case is run
> as a new object
> > The test now passes
> >
> > Modified:
> >
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> >
> > Modified:
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> > URL:
>
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java?rev=600881&r1=600880&r2=600881&view=diff
> >
> ==============================================================================
> > ---
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> (original)
> > +++
> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> Tue Dec  4 03:21:13 2007
> > @@ -24,6 +24,7 @@
> >  import org.ofbiz.entity.GenericValue;
> >  import org.ofbiz.service.GenericDispatcher;
> >  import org.ofbiz.service.LocalDispatcher;
> > +import org.ofbiz.service.ModelService;
> >  import org.ofbiz.base.util.UtilMisc;
> >
> >  import java.util.Map;
> > @@ -37,8 +38,6 @@
> >
> >      protected LocalDispatcher dispatcher = null;
> >      protected GenericValue userLogin = null;
> > -    protected String finAccountId = null;
> > -    protected double balance = 0.00;
> >
> >      public FinAccountTests(String name) {
> >          super(name);
> > @@ -55,32 +54,32 @@
> >
> >      public void testCreateFinAccount() throws Exception {
> >          Map ctx = FastMap.newInstance();
> > +        ctx.put("finAccountId", "TESTACCOUNT1");
> >          ctx.put("finAccountName", "Test Financial Account");
> > -        ctx.put("finAccountTypeId", "BALANCE_ACCOUNT");
> > +        ctx.put("finAccountTypeId", "BANK_ACCOUNT");
> >          ctx.put("userLogin", userLogin);
> >          Map resp = dispatcher.runSync("createFinAccount", ctx);
> > -        finAccountId = (String) resp.get("finAccountId");
> > -        assertNotNull(finAccountId);
> > +        assertEquals("Service result success",
> ModelService.RESPOND_SUCCESS, resp.get(ModelService.RESPONSE_MESSAGE));
> >      }
> >
> >      public void testDeposit() throws Exception {
> >          Map ctx = FastMap.newInstance();
> > -        ctx.put("finAccountId", finAccountId);
> > +        ctx.put("finAccountId", "TESTACCOUNT1");
> >          ctx.put("amount", new Double(100.00));
> >          ctx.put("userLogin", userLogin);
> >          Map resp = dispatcher.runSync("finAccountDeposit", ctx);
> > -        balance = ((Double) resp.get("balance")).doubleValue();
> > +        Double balance = ((Double) resp.get("balance")).doubleValue();
> >          assertEquals(balance, 100.00, 0.0);
> >      }
> >
> >      public void testWithdraw() throws Exception {
> >          Map ctx = FastMap.newInstance();
> > -        ctx.put("finAccountId", finAccountId);
> > +        ctx.put("finAccountId", "TESTACCOUNT1");
> >          ctx.put("amount", new Double(50.00));
> >          ctx.put("userLogin", userLogin);
> >          Map resp = dispatcher.runSync("finAccountWithdraw", ctx);
> >          Double previousBalance = (Double) resp.get("previousBalance");
> > -        balance = ((Double) resp.get("balance")).doubleValue();
> > +        Double balance = ((Double) resp.get("balance")).doubleValue();
> >          assertEquals((balance + 50.00), previousBalance.doubleValue(),
> 0.0);
> >      }
> >  }
> >
> >
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r600881 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java

Jacques Le Roux
Administrator
Thanks Scott,

I will do right now, I prefered to check with the commiter before because there are a lot of changes currently

Jacques

De : "Scott Gray" <[hidden email]>

> Hi Jacques
>
> I don't see why not, they were all bugfixes.
>
> Regards
> Scott
>
> On 05/12/2007, Jacques Le Roux <[hidden email]> wrote:
> >
> > Scott,
> >
> > A quick question about you last post around tests. Should we merge them
> > with release4.0 ?
> >
> > Jacques
> >
> > De : <[hidden email]>
> > > Author: lektran
> > > Date: Tue Dec  4 03:21:13 2007
> > > New Revision: 600881
> > >
> > > URL: http://svn.apache.org/viewvc?rev=600881&view=rev
> > > Log:
> > > Couple of fixes to FinAccountTests:
> > > 1.  There's no such type as a BALANCE_ACCOUNT so I switched to a
> > BANK_ACCOUNT
> > > 2.  You can't use instance variables in a test because each case is run
> > as a new object
> > > The test now passes
> > >
> > > Modified:
> > >
> > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> > >
> > > Modified:
> > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> > > URL:
> >
> >
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java?rev=600881&r1=600880&r2=600881&view=diff

> > >
> > ==============================================================================
> > > ---
> > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> > (original)
> > > +++
> > ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
> > Tue Dec  4 03:21:13 2007
> > > @@ -24,6 +24,7 @@
> > >  import org.ofbiz.entity.GenericValue;
> > >  import org.ofbiz.service.GenericDispatcher;
> > >  import org.ofbiz.service.LocalDispatcher;
> > > +import org.ofbiz.service.ModelService;
> > >  import org.ofbiz.base.util.UtilMisc;
> > >
> > >  import java.util.Map;
> > > @@ -37,8 +38,6 @@
> > >
> > >      protected LocalDispatcher dispatcher = null;
> > >      protected GenericValue userLogin = null;
> > > -    protected String finAccountId = null;
> > > -    protected double balance = 0.00;
> > >
> > >      public FinAccountTests(String name) {
> > >          super(name);
> > > @@ -55,32 +54,32 @@
> > >
> > >      public void testCreateFinAccount() throws Exception {
> > >          Map ctx = FastMap.newInstance();
> > > +        ctx.put("finAccountId", "TESTACCOUNT1");
> > >          ctx.put("finAccountName", "Test Financial Account");
> > > -        ctx.put("finAccountTypeId", "BALANCE_ACCOUNT");
> > > +        ctx.put("finAccountTypeId", "BANK_ACCOUNT");
> > >          ctx.put("userLogin", userLogin);
> > >          Map resp = dispatcher.runSync("createFinAccount", ctx);
> > > -        finAccountId = (String) resp.get("finAccountId");
> > > -        assertNotNull(finAccountId);
> > > +        assertEquals("Service result success",
> > ModelService.RESPOND_SUCCESS, resp.get(ModelService.RESPONSE_MESSAGE));
> > >      }
> > >
> > >      public void testDeposit() throws Exception {
> > >          Map ctx = FastMap.newInstance();
> > > -        ctx.put("finAccountId", finAccountId);
> > > +        ctx.put("finAccountId", "TESTACCOUNT1");
> > >          ctx.put("amount", new Double(100.00));
> > >          ctx.put("userLogin", userLogin);
> > >          Map resp = dispatcher.runSync("finAccountDeposit", ctx);
> > > -        balance = ((Double) resp.get("balance")).doubleValue();
> > > +        Double balance = ((Double) resp.get("balance")).doubleValue();
> > >          assertEquals(balance, 100.00, 0.0);
> > >      }
> > >
> > >      public void testWithdraw() throws Exception {
> > >          Map ctx = FastMap.newInstance();
> > > -        ctx.put("finAccountId", finAccountId);
> > > +        ctx.put("finAccountId", "TESTACCOUNT1");
> > >          ctx.put("amount", new Double(50.00));
> > >          ctx.put("userLogin", userLogin);
> > >          Map resp = dispatcher.runSync("finAccountWithdraw", ctx);
> > >          Double previousBalance = (Double) resp.get("previousBalance");
> > > -        balance = ((Double) resp.get("balance")).doubleValue();
> > > +        Double balance = ((Double) resp.get("balance")).doubleValue();
> > >          assertEquals((balance + 50.00), previousBalance.doubleValue(),
> > 0.0);
> > >      }
> > >  }
> > >
> > >
> >
> >
>