Examples of Person


Examples of org.springframework.test.context.junit4.orm.domain.Person

    assertNotNull("SessionFactory should have been autowired.", sessionFactory);
  }

  @Test
  public void findSam() {
    Person sam = personService.findByName(SAM);
    assertNotNull("Should be able to find Sam", sam);
    DriversLicense driversLicense = sam.getDriversLicense();
    assertNotNull("Sam's driver's license should not be null", driversLicense);
    assertEquals("Verifying Sam's driver's license number", new Long(1234), driversLicense.getNumber());
  }
View Full Code Here

Examples of org.springframework.test.util.subpackage.Person

  protected static final Float PI = new Float((float) 22 / 7);


  public void testSetField() throws Exception {
    final Person person = new Person();

    // Standard

    ReflectionTestUtils.setField(person, "id", new Long(99), long.class);
    ReflectionTestUtils.setField(person, "name", "Tom");
    ReflectionTestUtils.setField(person, "age", new Integer(42));
    ReflectionTestUtils.setField(person, "eyeColor", "blue", String.class);
    ReflectionTestUtils.setField(person, "likesPets", Boolean.TRUE);
    ReflectionTestUtils.setField(person, "favoriteNumber", PI, Number.class);

    assertEquals("Verifying that the person's ID (private field in a superclass) was set.", 99, person.getId());
    assertEquals("Verifying that the person's name (protected field) was set.", "Tom", person.getName());
    assertEquals("Verifying that the person's age (private field) was set.", 42, person.getAge());
    assertEquals("Verifying that the person's eye color (package private field) was set.", "blue",
        person.getEyeColor());
    assertEquals("Verifying that the person's 'likes pets' flag (package private boolean field) was set.", true,
        person.likesPets());
    assertEquals("Verifying that the person's 'favorite number' (package field) was set.", PI,
        person.getFavoriteNumber());

    assertEquals(new Long(99), ReflectionTestUtils.getField(person, "id"));
    assertEquals("Tom", ReflectionTestUtils.getField(person, "name"));
    assertEquals(new Integer(42), ReflectionTestUtils.getField(person, "age"));
    assertEquals("blue", ReflectionTestUtils.getField(person, "eyeColor"));
    assertEquals(Boolean.TRUE, ReflectionTestUtils.getField(person, "likesPets"));
    assertEquals(PI, ReflectionTestUtils.getField(person, "favoriteNumber"));

    // Null - non-primitives

    ReflectionTestUtils.setField(person, "name", null, String.class);
    ReflectionTestUtils.setField(person, "eyeColor", null, String.class);
    ReflectionTestUtils.setField(person, "favoriteNumber", null, Number.class);

    assertNull("Verifying that the person's name (protected field) was set.", person.getName());
    assertNull("Verifying that the person's eye color (package private field) was set.", person.getEyeColor());
    assertNull("Verifying that the person's 'favorite number' (package field) was set.", person.getFavoriteNumber());

    // Null - primitives

    new AssertThrows(IllegalArgumentException.class,
        "Calling setField() with NULL for a primitive type should throw an IllegalArgumentException.") {
View Full Code Here

Examples of org.springframework.test.web.Person

  @Controller
  private static class PersonController {

    @RequestMapping(value="/person/{name}", method=RequestMethod.GET)
    public String show(@PathVariable String name, Model model) {
      Person person = new Person(name);
      model.addAttribute(person);
      return "person/show";
    }
View Full Code Here

Examples of org.springframework.tests.sample.beans.Person

    pf.addAdvice(new SerializableNopInterceptor());
    // Try various advice types
    pf.addAdvice(new CountingBeforeAdvice());
    pf.addAdvice(new CountingAfterReturningAdvice());
    pf.addAdvice(cta);
    Person p = (Person) createAopProxy(pf).getProxy();

    p.echo(null);
    assertEquals(0, cta.getCalls());
    try {
      p.echo(new IOException());
    }
    catch (IOException ex) {

    }
    assertEquals(1, cta.getCalls());

    // Will throw exception if it fails
    Person p2 = (Person) SerializationTestUtils.serializeAndDeserialize(p);
    assertNotSame(p, p2);
    assertEquals(p.getName(), p2.getName());
    assertEquals(p.getAge(), p2.getAge());
    assertTrue("Deserialized object is an AOP proxy", AopUtils.isAopProxy(p2));

    Advised a1 = (Advised) p;
    Advised a2 = (Advised) p2;
    // Check we can manipulate state of p2
    assertEquals(a1.getAdvisors().length, a2.getAdvisors().length);

    // This should work as SerializablePerson is equal
    assertEquals("Proxies should be equal, even after one was serialized", p, p2);
    assertEquals("Proxies should be equal, even after one was serialized", p2, p);

    // Check we can add a new advisor to the target
    NopInterceptor ni = new NopInterceptor();
    p2.getAge();
    assertEquals(0, ni.getCount());
    a2.addAdvice(ni);
    p2.getAge();
    assertEquals(1, ni.getCount());

    cta = (CountingThrowsAdvice) a2.getAdvisors()[3].getAdvice();
    p2.echo(null);
    assertEquals(1, cta.getCalls());
    try {
      p2.echo(new IOException());
    }
    catch (IOException ex) {

    }
    assertEquals(2, cta.getCalls());
View Full Code Here

Examples of org.springmodules.email.Person

    }

    public void testSend() throws Exception {

        Map model = new HashMap();
        model.put("sender", new Person("Daan", "daan@bla.com"));
        model.put("recipient", new Person("Lian", "lian@bla.com"));
        dispatcher.send("email.eml", model);

        assertEquals(1, server.getReceivedEmailSize());
        SmtpMessage message = (SmtpMessage)server.getReceivedEmail().next();
        assertEquals("Daan <daan@bla.com>", message.getHeaderValue("From"));
View Full Code Here

Examples of org.springmodules.validation.bean.Person

*/
public class ValangErrorArgumentsResolverTests extends TestCase {

    public void testResolveArguments_WithPath() throws Exception {
        ValangErrorArgumentsResolver resolver = new ValangErrorArgumentsResolver(new String[] { "name.class.name" });
        Object[] args = resolver.resolveArguments(new Person("Uri"));

        assertNotNull(args);
        assertEquals(1, args.length);
        assertEquals("java.lang.String", args[0]);
    }
View Full Code Here

Examples of org.springmodules.validation.valang.parser.Person

        assertFalse(validate(new Person(30, "Steven"), text));
    }

    public void testTranslator8HasTextRule() {
        String text = "{firstName : firstName has text : 'First name is required.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(20, "    "), text));
    }
View Full Code Here

Examples of org.spw.model.Person

    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1)getBean("ApplicationBean1");
    }
   
    public String hyperlinkCreateVolunteer_action() {
        Person person = getSessionBean1().getPerson();
        // if Person, create an instance of Volunteer
        if (person instanceof Volunteer) {
            return null;
        } else {
            getSessionBean1().setVolunteer(new Volunteer((Person) person));
View Full Code Here

Examples of org.strecks.form.impl.Person

    genders.put(1L, new Gender(1L, "male"));
    genders.put(2L, new Gender(2L, "female"));

    selectForm.setAvailableGenders(genders);

    Person person = new Person();
    person.setName("me");

    BindAnnotationReader bindablesReader = new BindAnnotationReader();
    BindConvertInfo bindConvertInfo = bindablesReader.readBindables(selectForm);
    Map<String, BindHandler> map = bindConvertInfo.getBindMap();
     
View Full Code Here

Examples of org.structr.core.entity.Person

   
    App app = StructrApp.getInstance();

    try (final Tx tx = app.tx()) {

      Person chrisi = app.create(Person.class, "chrisi");
      Person axel   = app.create(Person.class, "axel");
     
      chrisi.setProperty(Person.name, "chrisi2");

      tx.success();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.