Package tests.jfun.models

Examples of tests.jfun.models.BankAccount


        "tests/jfun/yan/web/yan.xml");
    HttpServlet servlet = new YanLoaderServlet();
    MockServletConfig config = new MockServletConfig();
    config.setServletContext(sc);
    servlet.init(config);
    final BankAccount acct = verifyBean(sc, "account");
    servlet.destroy();
    assertTrue("Destroyed", acct.isDestroyed());
  }
View Full Code Here


  }
  private void verifyListener(ServletContext sc, String beanname){
    ServletContextListener listener = new YanLoaderListener();
    ServletContextEvent event = new ServletContextEvent(sc);
    listener.contextInitialized(event);
    final BankAccount acct = verifyBean(sc, beanname);
    listener.contextDestroyed(event);
    assertTrue(acct.isDestroyed());
  }
View Full Code Here

    if(count > 0)
      throw new IllegalStateException("should not have more than 1 instances");
    count++;
  }
  public static BankAccount create(String id, int balance){
    BankAccount acct = new SingletonBankAccount();
    acct.balance = balance;
    acct.setId(id);
    return acct;
  }
View Full Code Here

      yan.registerValue(new char[]{'a','b'});
      BankAccountDao mdao = (BankAccountDao)yan.getInstance("dao");
      assertEquals(mdao, mdao);
      MyBean mbean = mdao.getMyBean(1);
      assertEquals("apple", mbean.getName());
      BankAccount account = mdao.getAccount("a");
      assertEquals('a', account.getChar(0));
      assertEquals('b', account.getChar(1));
      assertEquals("apple", account.getId());
      assertEquals(10, account.getBalance());
    }
View Full Code Here

  throws Throwable{

    runTest("test/yan/test.xml");
    final Component c = yan.getComponent("service_maker");
    assertNotNull(c);
    final BankAccount acc = new BankAccount("test", 1000000);
    final Component service =
      c.withArguments(new Component[]{Components.value(acc), Components.value("getBalance")});
    final Integer bal = (Integer)yan.instantiateComponent(service);
    assertEquals(1000000, bal.intValue());
   
View Full Code Here

TOP

Related Classes of tests.jfun.models.BankAccount

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.