DdlGenerator构造函数不需要参数? [英] DdlGenerator constructor needs no arguments?

查看:136
本文介绍了DdlGenerator构造函数不需要参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对我的数据库操作进行单元测试,我发现此代码。但是,我得到以下错误:

I wanted to unit test my database operation and I found this code. However, I get the followin error:

[CityGame] $ test
[info] Compiling 2 Java sources to /Users/pmichna/Documents/code/citygame/target/scala-2.10/test-classes...
[error] /Users/pmichna/Documents/code/citygame/test/models/BaseModelTest.java:31: error: constructor DdlGenerator in class DdlGenerator cannot be applied to given types;
[error]         ddl = new DdlGenerator((SpiEbeanServer) server, new MySqlPlatform(), config);
[error]               ^
[error]   required: no arguments
[error]   found: SpiEbeanServer,MySqlPlatform,ServerConfig
[error]   reason: actual and formal argument lists differ in length
[error] 1 error
[error] (test:compile) javac returned nonzero exit code
[error] Total time: 2 s, completed 2013-12-17 00:21:23

DdlGenerator 的实现是否已更改?

推荐答案

是的,实施已更改。构造函数不带参数,而是应该使用 setup()方法。这导致这样的:

Yes, the implementation has changed. The constructor takes no argument but instead there is a setup() method that should be used. This lead to something like this :

EbeanServer server = Ebean.getServer(serverName);
ServerConfig config = new ServerConfig();
DdlGenerator ddl = new DdlGenerator();
ddl.setup((SpiEbeanServer) server, new MySqlPlatform(), config);

这篇关于DdlGenerator构造函数不需要参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆