01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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.
14:
15: package org.apache.tapestry.internal.structure;
16:
17: import org.apache.tapestry.MarkupWriter;
18: import org.apache.tapestry.internal.test.InternalBaseTestCase;
19: import org.apache.tapestry.runtime.RenderQueue;
20: import org.testng.annotations.Test;
21:
22: public class BlockImplTest extends InternalBaseTestCase {
23: @Test
24: public void empty_block() {
25: BlockImpl block = new BlockImpl(null);
26: RenderQueue queue = mockRenderQueue();
27: MarkupWriter writer = mockMarkupWriter();
28:
29: replay();
30:
31: block.render(writer, queue);
32:
33: verify();
34: }
35:
36: @Test
37: public void body_pushed_to_queue_backwards() {
38: BlockImpl block = new BlockImpl(null);
39: RenderQueue queue = mockRenderQueue();
40: MarkupWriter writer = mockMarkupWriter();
41: PageElement element1 = mockPageElement();
42: PageElement element2 = mockPageElement();
43:
44: getMocksControl().checkOrder(true);
45:
46: queue.push(element2);
47: queue.push(element1);
48:
49: replay();
50:
51: block.addToBody(element1);
52: block.addToBody(element2);
53:
54: block.render(writer, queue);
55:
56: verify();
57: }
58: }
|