summaryrefslogtreecommitdiffstats
path: root/sandbox/old/contrib/implementation-bsf/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
blob: 1ae65737f996524b473d69cdba7e17b719bd3c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package org.apache.tuscany.container.script.mock;

import org.apache.bsf.BSFException;
import org.apache.bsf.util.BSFEngineImpl;

public class MockBSFEngine extends BSFEngineImpl {

    public Object call(Object object, String name, Object[] args) throws BSFException {
        if ("bang".equals(name)) {
            throw new RuntimeException(name);
        }
        
        String resp = name + ":";
        if (args != null) {
            for (Object o : args) {
                resp += " " + String.valueOf(o);
            }
        }
        return resp;
    }

    public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException {
        // not used for the mock tests
        return null;
    }

}