001/* Copyright (C) 2013 TU Dortmund 002 * This file is part of LearnLib, http://www.learnlib.de/. 003 * 004 * LearnLib is free software; you can redistribute it and/or 005 * modify it under the terms of the GNU Lesser General Public 006 * License version 3.0 as published by the Free Software Foundation. 007 * 008 * LearnLib is distributed in the hope that it will be useful, 009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 011 * Lesser General Public License for more details. 012 * 013 * You should have received a copy of the GNU Lesser General Public 014 * License along with LearnLib; if not, see 015 * <http://www.gnu.de/documents/lgpl.en.html>. 016 */ 017package de.learnlib.drivers.reflect; 018 019import de.learnlib.drivers.api.TestDriver; 020import java.lang.reflect.Constructor; 021import java.lang.reflect.Method; 022import java.util.HashMap; 023import net.automatalib.words.Alphabet; 024import net.automatalib.words.impl.SimpleAlphabet; 025 026/** 027 * Simple test driver for plain java objects. Uses a very simple data mapper 028 * without state or storage. Inputs cannot have abstract parameters. 029 * 030 * @author falkhowar 031 */ 032public final class SimplePOJOTestDriver extends 033 TestDriver<AbstractMethodInput, AbstractMethodOutput, ConcreteMethodInput, Object> { 034 035 private final SimpleAlphabet<AbstractMethodInput> inputs = new SimpleAlphabet<>(); 036 037 public SimplePOJOTestDriver(Constructor c, Object ... cParams) { 038 super(new SimplePOJODataMapper(c, cParams)); 039 } 040 041 public AbstractMethodInput addInput(String name, Method m, Object ... params) { 042 AbstractMethodInput i = new AbstractMethodInput(name, m, new HashMap<String, Integer>(), params); 043 inputs.add(i); 044 return i; 045 } 046 047 /** 048 * @return the inputs 049 */ 050 public Alphabet<AbstractMethodInput> getInputs() { 051 return this.inputs; 052 } 053 054}