⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parameterelementtest.java

📁 一个java工作流引擎
💻 JAVA
字号:
package org.jbpm.web.formgen;

import java.io.IOException;
import java.util.HashMap;

import javax.servlet.jsp.JspWriter;

import junit.framework.TestCase;

public class ParameterElementTest extends TestCase {
  
  private ParameterElement parameterElement = null;
  private HashMap parameterMap = null;
  private String writtenText = null;
  
  protected void setUp() {
    parameterMap = new HashMap();
    parameterMap.put("existingKey", "existingValue");
    writtenText = null;
  }
  
  public void testWriteExisting() throws Exception {
    parameterElement = new ParameterElement("existingKey");
    parameterElement.write(new TestJspWriter(), parameterMap);
    assertEquals("1", writtenText, "existingValue");
  }
  
  public void testWriteUnexisting() throws Exception {
    parameterElement = new ParameterElement("unexistingKey");
    parameterElement.write(new TestJspWriter(), parameterMap);
    assertNull("1", writtenText);
  }

  class TestJspWriter extends JspWriter {
    protected TestJspWriter() {super(0, false);}
    public void newLine() throws IOException {}
    public void print(boolean arg0) throws IOException {}
    public void print(char arg0) throws IOException {}
    public void print(int arg0) throws IOException {}
    public void print(long arg0) throws IOException {}
    public void print(float arg0) throws IOException {}
    public void print(double arg0) throws IOException {}
    public void print(char[] arg0) throws IOException {}
    public void print(String arg0) throws IOException {}
    public void print(Object arg0) throws IOException {}
    public void println() throws IOException {}
    public void println(boolean arg0) throws IOException {}
    public void println(char arg0) throws IOException {}
    public void println(int arg0) throws IOException {}
    public void println(long arg0) throws IOException {}
    public void println(float arg0) throws IOException {}
    public void println(double arg0) throws IOException {}
    public void println(char[] arg0) throws IOException {}
    public void println(String arg0) throws IOException {}
    public void println(Object arg0) throws IOException {}
    public void clear() throws IOException {}
    public void clearBuffer() throws IOException {}
    public void flush() throws IOException {}
    public void close() throws IOException {}
    public int getRemaining() {return 0;}
    public void write(char[] cbuf, int off, int len) throws IOException {
      writtenText = new String(cbuf).trim();
    }
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -