Package org.springframework.ui

Examples of org.springframework.ui.ModelMap.containsAttribute()


    //assert that the model size is three
    assertThat(model.size(), CoreMatchers.equalTo(modelSize));

    //assert that the model does contain an attribute associated with the authenticated user
    assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true));

    //assert that the model does not contain authenticated user as null
    assertThat(model.get(userProfile), CoreMatchers.notNullValue());

    //assert that the status of user is updated
View Full Code Here


   
    //assert that the model size is two
    assertThat(model.size(), CoreMatchers.equalTo(2));
   
    //assert that the model does contain an attribute associated with newUser after setUpForm() is called
    assertThat(model.containsAttribute(newUser), CoreMatchers.equalTo(true));
   
    //assert that the model does not contain new user as null
    assertThat(model.get(newUser), CoreMatchers.notNullValue());
  }
 
View Full Code Here

    @Test
    public void setupForm() {
        ModelMap modelMap = new ExtendedModelMap();
        final String viewName = controller.setUpForm(modelMap);
        assertEquals(ViewNames.ADMIN_NEW_ACCOUNT, viewName);
        assertTrue(modelMap.containsAttribute(TABS));
        assertTrue(modelMap.get(ModelKeys.NEW_USER) instanceof NewUser);
    }

    @Test
    public void create_ValidFormSubmitted() throws Exception {
View Full Code Here

        final ModelMap model = new ModelMap();
        controller.initialize(model, request);
        assertThat(model, CoreMatchers.notNullValue());
        // captcha & user mode should be
        assertEquals("Expected Captcha and User model", 2, model.size());
        assertThat(model.containsAttribute(ModelKeys.USER), CoreMatchers.equalTo(true));
        assertThat(model.containsAttribute(ModelKeys.CAPTCHA_HTML), CoreMatchers.equalTo(true));
        assertThat(model.get(ModelKeys.USER), CoreMatchers.notNullValue());
        assertThat(model.get(ModelKeys.CAPTCHA_HTML), CoreMatchers.notNullValue());
        assertThat(captchaService.isValid(request), CoreMatchers.equalTo(true));
View Full Code Here

        controller.initialize(model, request);
        assertThat(model, CoreMatchers.notNullValue());
        // captcha & user mode should be
        assertEquals("Expected Captcha and User model", 2, model.size());
        assertThat(model.containsAttribute(ModelKeys.USER), CoreMatchers.equalTo(true));
        assertThat(model.containsAttribute(ModelKeys.CAPTCHA_HTML), CoreMatchers.equalTo(true));
        assertThat(model.get(ModelKeys.USER), CoreMatchers.notNullValue());
        assertThat(model.get(ModelKeys.CAPTCHA_HTML), CoreMatchers.notNullValue());
        assertThat(captchaService.isValid(request), CoreMatchers.equalTo(true));

    }
View Full Code Here

    //assert that the model size is two
    assertThat(model.size(), CoreMatchers.equalTo(2));

    //assert that the model does contain an attribute associated with User after setUpForm() is called
    assertThat(model.containsAttribute(User), CoreMatchers.equalTo(true));

    //assert that the model does not contain new user as null
    assertThat(model.get(User), CoreMatchers.notNullValue());
  }
View Full Code Here

    //assert that the model size is four
    assertThat(model.size(), CoreMatchers.equalTo(modelSize));

    //assert that the model does contain an attribute associated with the authenticated user after setUpForm() is called
    assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true));

    //assert that the model does not contain authenticated user as null
    assertThat(model.get(userProfile), CoreMatchers.notNullValue());

        assertThat(view, is(ViewNames.PERSON_PROFILE + "." + VALID_PAGE_LAYOUT_CODE));
View Full Code Here

    //assert that the model size is four
    assertThat(model.size(), CoreMatchers.equalTo(modelSize));

    //assert that the model does contain an attribute associated with the authenticated user after setUpForm() is called
    assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true));

    //assert that the model does not contain authenticated user as null
    assertThat(model.get(userProfile), CoreMatchers.notNullValue());

        assertThat(view, is(ViewNames.PERSON_PROFILE + "." + VALID_PAGE_LAYOUT_CODE));
View Full Code Here

    //assert that the model size is three
    assertThat(model.size(), CoreMatchers.equalTo(modelSize));

    //assert that the model does contain an attribute associated with the authenticated user
    assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true));

    //assert that the model does not contain authenticated user as null
    assertThat(model.get(userProfile), CoreMatchers.notNullValue());

    //assert that the status of user is updated
View Full Code Here

    @Test
    public void setupForm() {
        ModelMap modelMap = new ExtendedModelMap();
        final String viewName = controller.setUpForm(modelMap);
        assertEquals(ViewNames.ADMIN_NEW_ACCOUNT, viewName);
        assertTrue(modelMap.containsAttribute(TABS));
        assertTrue(modelMap.get(ModelKeys.NEW_USER) instanceof UserImpl);
    }

    @Test
    public void create_ValidFormSubmitted() throws Exception {
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.