EmployeeDataBase { public static EmployeeDataBase getInstance(String script) { try { EmployeeDataBase employeeDataBase = new EmployeeDataBase(); ScriptEngine eng = ScriptFactory.getScriptEngine(ScriptFactory.BEANSHELL); eng.put("edb", employeeDataBase); eng.eval(script); return employeeDataBase; } catch (ScriptException e) { throw new RuntimeException(e); } }  List<Employee> getEmployees(); void addEmployee(String name, double wageRate, String pin); @Deprecated void addEmployee(String name, double wageRate); void addOrUpdateEmployee(Employee employee); void removeEmployee(Employee employeeToRemove); static EmployeeDataBase getInstance(String script); String toScript();  }
@Test public void testGetInstance() throws Exception { String script = "edb.addEmployee(\"Test\",35.5);"; EmployeeDataBase employeeDataBase = EmployeeDataBase.getInstance(script); Collection<Employee> employees = employeeDataBase.getEmployees(); assertFalse(employees.isEmpty()); Employee employee = employees.iterator().next(); assertEquals("Test", employee.getName()); assertEquals(35.5, employee.getWageRate(), 0.001); }