GRAILS-1019: Allowing expressions to be used with the 'disabled' attribute for g...
[grails.git] / test / web / org / codehaus / groovy / grails / web / servlet / GrailsFlashScopeTests.java
blobb1c10f23b8fc633469ab1c90f55b89f9f716e0f4
1 /* Copyright 2004-2005 the original author or authors.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
15 package org.codehaus.groovy.grails.web.servlet;
17 import grails.util.GrailsWebUtil;
18 import junit.framework.TestCase;
20 /**
21 * @author Graeme Rocher
22 * @since 07-Feb-2006
24 public class GrailsFlashScopeTests extends TestCase {
27 public void testNextState() {
29 GrailsWebUtil.bindMockWebRequest();
31 FlashScope fs = new GrailsFlashScope();
32 fs.put("test","value");
33 fs.put("fred","flintstone");
35 assertFalse(fs.isEmpty());
36 assertEquals("flintstone",fs.get("fred"));
37 assertEquals(2, fs.size());
38 assertTrue(fs.containsKey("test"));
39 assertTrue(fs.containsValue("value"));
40 assertFalse(fs.containsKey("wilma"));
42 // the state immediately following this one the map should still contain the previous
43 // entries
44 fs.next();
46 assertFalse(fs.isEmpty());
47 assertEquals("flintstone",fs.get("fred"));
48 assertEquals(2, fs.size());
49 assertTrue(fs.containsKey("test"));
50 assertTrue(fs.containsValue("value"));
51 assertFalse(fs.containsKey("wilma"));
53 // the next state it should be empty
54 fs.next();
56 assertTrue(fs.isEmpty());
57 assertEquals(0,fs.size());