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

📄 mockclassquery.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by Joakim Ohlrogge are// Copyright (C) 1997-@year@ by Joakim Ohlrogge. All rights reserved.//// $Id$package test.ozoneDB.tools.OPP.srcgen.query;import org.ozoneDB.tools.OPP.srcgen.ClassQuery;import com.mockobjects.ExpectationMap;import com.mockobjects.Verifiable;import com.mockobjects.util.Verifier;import java.util.HashMap;import java.util.Map;/** * User: Jocke * Date: 2004-jan-03 * Time: 15:09:13 */public class MockClassQuery implements ClassQuery, Verifiable {    private ExpectationMap getInterfacesExpectations = new ExpectationMap("getInterfaces");    private ExpectationMap isInterfaceExpectations = new ExpectationMap("isInterface");    private ExpectationMap isAssignableFrom = new ExpectationMap("isAssignableFrom");    private Map fromClasses = new HashMap();    public void setupIsAssignable(String itf, String from, boolean result) {        ExpectationMap fromValues;        if (!fromClasses.keySet().contains(itf)) {            fromValues = new ExpectationMap(itf + " from values");            fromClasses.put(itf, fromValues);            isAssignableFrom.addExpected(itf, fromValues);        } else {            fromValues = (ExpectationMap) fromClasses.get(itf);        }        fromValues.addExpected(from, Boolean.valueOf(result));    }    public void setupGetInterfaces(String className, String interfaces[]) {        getInterfacesExpectations.addExpected(className, interfaces);    }    public void setupIsInterface(String className, boolean result) {        isInterfaceExpectations.addExpected(className, Boolean.valueOf(result));    }    public boolean isAssignable(String itf, String from) throws ClassNotFoundException {        ExpectationMap fromClasses = (ExpectationMap) isAssignableFrom.get(itf);        Boolean result = (Boolean) fromClasses.get(from);        return result.booleanValue();    }    public String[] getInterfaces(String className) throws ClassNotFoundException {        return (String[]) getInterfacesExpectations.get(className);    }    public boolean isInterface(String className) throws ClassNotFoundException {        Boolean result = (Boolean) isInterfaceExpectations.get(className);        return result.booleanValue();    }    public void verify() {        Verifier.verifyObject(this);    }}

⌨️ 快捷键说明

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