Package test.component3

Examples of test.component3.Person


     * @see Person#getAge()
     */
    @Test
    public void getAllPersonsEligibleToVote() {
        List<Person> potentialVoters =
                new ArrayList<>(asList(new Person("Tom", 24), new Person("Dick", 75), new Person("Harry", 17)));

        int legalAgeOfVoting = 18;
        List<Person> eligibleVoters = VotingRules.eligibleVoters(potentialVoters, legalAgeOfVoting);

        assertThat(eligibleVoters, hasSize(2));
View Full Code Here


   }
  
   public void test1() throws Exception
   {
      MyStateful stateful = (MyStateful) getInitialContext(0).lookup("MyStatefulBean/remote");
      Person p = new Person("Brian");
      stateful.save(p);
      String expected = "Changing SFSB state";
      stateful.setDescription(expected);
      stateful.setUpFailover("once");
      try
View Full Code Here

    public void test_Person_binding() throws IOException, SAXException {
        XMLBinding xmlBinding = new XMLBinding().add(getClass().getResourceAsStream("config5/person-binding-config.xml"));
        xmlBinding.intiailize();

        Person person = xmlBinding.fromXML("<person name='Max' age='50' />", Person.class);
        String xml = xmlBinding.toXML(person);
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual("<person name='Max' age='50' />", xml);

    }
View Full Code Here

  private static final long serialVersionUID = 1L;

  public HomePage(final PageParameters parameters) {
    super(parameters);

    setDefaultModel(new CompoundPropertyModel<Person>(new Person()));
   
    Form<Void> form = new Form<Void>("form");
   
    form.add(new TextField("name").add(new PropertyValidator()));
    form.add(new TextField("email").add(new PropertyValidator()));
View Full Code Here

    log.debug(set1.toString());
  }

  @Test
  public void testArrayInject() {
    CollectionService collectionService = xmlApplicationContext
        .getBean("collectionService3");
    String[] strArray = collectionService.getStrArray();
    Assert.assertThat(strArray.length, greaterThan(0));
    log.debug(Arrays.toString(strArray));

    collectionService = xmlApplicationContext.getBean("collectionService4");
    int[] intArray = collectionService.getIntArray();
    Assert.assertThat(intArray.length, greaterThan(0));
    log.debug(Arrays.toString(intArray));

    collectionService = xmlApplicationContext.getBean("collectionService5");
    Object[] obj = collectionService.getObjArray();
    Assert.assertThat(obj.length, greaterThan(0));
    Object[] obj2 = (Object[]) obj[3];
    Assert.assertThat(obj2.length, greaterThan(0));
    Assert.assertThat((Long) obj2[1], is(10000000000L));
  }
View Full Code Here

  }

  @Test(expected = ClassCastException.class)
  public void testIdTypeError() {
    ApplicationContext context = new XmlApplicationContext("firefly2.xml");
    CollectionService collectionService = context
        .getBean("collectionService");
    for (Integer i : collectionService.getSet())
      i++;

  }
View Full Code Here

  }

  @Test
  public void testXmlLinkedListInject() {
    // 注入的不仅仅是List
    CollectionService collectionService = xmlApplicationContext
        .getBean("collectionService");
    List<Object> list = collectionService.getList();
    Assert.assertThat(list.size(), greaterThan(0));
    log.debug(list.toString());
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testListInject() {
    // list的值也是list
    CollectionService collectionService = xmlApplicationContext
        .getBean("collectionService2");
    List<Object> list = collectionService.getList();
    Assert.assertThat(list.size(), greaterThan(2));
    Set<String> set = (Set<String>) list.get(2);
    Assert.assertThat(set.size(), is(2));
    log.debug(set.toString());

    // set赋值
    Set<Integer> set1 = collectionService.getSet();
    Assert.assertThat(set1.size(), is(2));
    log.debug(set1.toString());
  }
View Full Code Here

  }

  @Test
  public void testMapInject() {
    MapService mapService = xmlApplicationContext.getBean("mapService");
    Map<Object, Object> map = mapService.getMap();
    // System.out.println("size ================================ "+map.size());
    for (Entry<Object, Object> entry : map.entrySet()) {
      log.info(entry.getKey() + "\t" + entry.getValue());
      if(entry.getKey().getClass().isArray()) {
        Object[] objects = (Object[])entry.getKey();
View Full Code Here

  private static Log log = LogFactory.getInstance().getLog("firefly-system");
  public static ApplicationContext xmlApplicationContext = new XmlApplicationContext();

  @Test
  public void testXmlInject() {
    Person person = xmlApplicationContext.getBean("person");
    Assert.assertThat(person.getName(), is("Jack"));
    PersonService personService = xmlApplicationContext
        .getBean("personService");
    List<Object> l = personService.getTestList();
    Assert.assertThat(l.size(), greaterThan(0));
    int i = 0;
    for (Object p : l) {
      if (p instanceof Person) {
        person = (Person) p;
        i++;
        log.debug(person.getName());
      } else if (p instanceof Map) {
        @SuppressWarnings("unchecked")
        Map<Object, Object> map = (Map<Object, Object>)p;
        log.info(map.toString());
        Assert.assertThat(map.entrySet().size(), greaterThan(0));
View Full Code Here

TOP

Related Classes of test.component3.Person

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.