我们正在使用Maven 3.0.3并使用JUnit 4.8.1 ...
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我们有这个测试文件......
./src/test/java/com/myco/clearing/common/xml/TextNodeTest.java
Run Code Online (Sandbox Code Playgroud)
我怎样才能运行这个单独的测试?当我尝试
mvn -Dtest=TextNodeTest test
Run Code Online (Sandbox Code Playgroud)
我得到一个错误,说没有运行测试.如果我将整个包名称指定给我的测试,我会得到相同的错误....
mvn clean -Dtest=com.myco.clearing.common.xml.TextNodeTest test
Run Code Online (Sandbox Code Playgroud)
产生错误信息......
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project myco-productplus-web: No tests were executed!
(Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的Spring(v.3.1.0.RELEASE)测试和使用Mockito 1.9.0自动装配一个模拟的DAO对象.我想要模拟的字段的控制器类是
@Controller
@RequestMapping("/registrationform.jsp")
public class RegistrationController {
private static Logger LOG = Logger.getLogger(RegistrationController.class);
@Autowired
private RegistrationValidation registrationValidation;
@Autowired
private UsersDao usersDao;
Run Code Online (Sandbox Code Playgroud)
我有这个testApplicationContext.xml文件...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- Enable annotation driven controllers, validation etc... -->
<mvc:annotation-driven />
<context:component-scan base-package="com.myco.eventmaven" />
<!-- Mock object for the UsersDao -->
<bean id="usersDao" name="mockDao" class="org.mockito.Mockito" factory-method="mock" >
<constructor-arg value="com.myco.eventmaven.dao.UsersDao" />
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean> …Run Code Online (Sandbox Code Playgroud) 我在Mac 10.5.7上使用Perl 5.12.我有一个JAR文件,我希望解压缩,然后处理匹配文件模式的文件.我无法弄清楚如何迭代解压缩的结果.我有 ...
### build an Archive::Extract object ###
my $ae = Archive::Extract->new( archive => $dbJar );
### what if something went wrong?
my $ok = $ae->extract or die $ae->error;
### files from the archive ###
my @files = $ae->files;
for (@files) {
print "file : $_\n";
Run Code Online (Sandbox Code Playgroud)
但是循环中只返回了一个东西 - "ARRAY(0x7fd5c22f7cd8)".我知道存档中有很多文件,所以我很好奇我在这里做错了什么. - 戴夫
我使用的是 Maven 3.1.1、Java 6 和 JBoss 7.1.3。我想将 JSP 上的对象呈现为 JSON,但是当我将它包含在我的 pom 中时
<dependency>
<groupId>json-taglib</groupId>
<artifactId>json-taglib</artifactId>
<version>0.4.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我收到这个通知...
[ERROR] Failed to execute goal on project myproject: Could not resolve dependencies for project org.mainco.subco:myproject:war:66.0.0-SNAPSHOT: Failure to find json-taglib:json-taglib:jar:0.4.1 in https://repository-myrepo.forge.cloudbees.com/release was cached in the local repository, resolution will not be reattempted until the update interval of cloudbees-private-release-repository has elapsed or updates are forced -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
这个工件在任何公共仓库中都可用吗?我想避免下载工件或将其安装到只有我可以访问的存储库。或者,如果有一个可公开访问的库可以做同样的事情,我可以使用它。
编辑:根据给出的答案设置我的存储库指令,但仍然出现错误
<repository>
<id>atg-json-taglib</id>
<name>ATG JSON</name>
<url>http://maven.nuxeo.org/nexus/content/repositories/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
Run Code Online (Sandbox Code Playgroud) I\xe2\x80\x99m 使用 Mockito 1.9.5。我想验证我的方法(以数组作为参数)被调用,其中数组恰好包含一个特定对象。我\xe2\x80\x99m 无法弄清楚如何执行此操作。我有
\n\nMockito.doReturn(new SaveResult[]{}).when(mockConnection).update(org.mockito.Matchers.any(SObject[].class));\n\xe2\x80\xa6 \n\nMockito.verify(mockConnection, Mockito.times(1)).update( new Account[]{ acct });\nRun Code Online (Sandbox Code Playgroud)\n\n毫不奇怪,第二行失败,因为尽管参数 \xe2\x80\x9cacct\xe2\x80\x9d 与传递的内容相同,但封闭的数组却不同。检查此情况的最佳方法是什么?
\n我在带有 Java 8 的 Mac Yosemite 上使用 Gradle 2.7。我正在使用 Liquibase 1.1.1 插件并想用它来做一些活动(构建一个测试数据库并构建我的普通数据库)。所以我有
liquibase {
activities {
main {
File propsFile = new File("${project.rootDir}/src/main/resources/liquibase.properties")
Properties properties = new Properties()
properties.load(new FileInputStream(propsFile))
changeLogFile 'src/main/resources/db.changelog-master.xml'
url properties['url']
username properties['username']
password properties['password']
}
test {
url 'jdbc:h2:file:target/testdb'
username 'sa'
}
runList = (
"test"
"main"
)
}
}
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚 runList 的正确语法。运行上述程序时出现错误...
* Where:
Build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle' line: 163
* What went wrong:
Could not compile build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle'.
> startup failed:
build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle': …Run Code Online (Sandbox Code Playgroud) 我正在使用Gradle 2.7,MySQL 5.5.46和Liquibase-Gradle 1.1.1插件.我有一个文件,其存储过程看起来像......
DELIMITER //
DROP PROCEDURE IF EXISTS MyProc;
CREATE PROCEDURE MyProc(
IN param1 VARCHAR(25),
IN param2 VARCHAR(5),
OUT outParam VARCHAR(2500))
BEGIN
…
END //
Run Code Online (Sandbox Code Playgroud)
我可以在MySQL命令行上很好地导入这个文件.但是,当我创建这个Liquibase变更集时......
<changeSet id="create_my_stored_proc" author="davea">
<sqlFile path="src/main/resources/scripts/my_stored_proc.sql" stripComments="true"/>
</changeSet>
Run Code Online (Sandbox Code Playgroud)
运行它,我得到错误
Caused by: liquibase.exception.DatabaseException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER //
DROP PROCEDURE IF EXISTS MyProc’ at line 1
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at …Run Code Online (Sandbox Code Playgroud) 我使用的是Rails 4.2.3.我在控制器中有这一行
service = XACTEService.new(“Event”, '2015-06-01', 'Zoo')
Run Code Online (Sandbox Code Playgroud)
有问题的类在app/services/XACTEService.rb中定义.但是在访问我的控制器时,我收到错误
uninitialized constant MyObjectsController::XACTEService
Run Code Online (Sandbox Code Playgroud)
但是,我已将此添加到我的config/application.rb文件中
class Application < Rails::Application
config.autoload_paths += %W(#{config.root}/services)
Run Code Online (Sandbox Code Playgroud)
所以我不明白为什么控制器无法找到我的服务.
service ruby-on-rails uninitialized-constant ruby-on-rails-4
我正在使用 Rails 4.2.7。我下载了一个示例,它显然要求我使用 Ruby 2.1.6 而不是我安装的 Ruby 2.3.0 版本……
localhost:lti_tool_provider_example-master davea$ bundle install
Your Ruby version is 2.3.0, but your Gemfile specified 2.1.6
Run Code Online (Sandbox Code Playgroud)
所以这就是我所做的。但是在安装 Ruby 2.1.6 之后,现在“捆绑安装”不起作用……
localhost:lti_tool_provider_example-master davea$ rvm install ruby-2.1.6
Warning! PATH is not properly set up, '/Users/davea/.rvm/gems/ruby-2.3.0/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session …Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery 1.12.我通过采用常规的SELECT菜单创建了一个风格化的选择mneu(使用UL和LI),应用了以下样式
.select-options {
display: none;
position: absolute;
top: 100%;
right: 0;
left: 0;
z-index: 999;
margin: 0;
padding: 0;
list-style: none;
background-color: #737373;
overflow: scroll;
}
.select-options li {
margin: 0;
padding: 12px 0;
text-indent: 15px;
border-top: 1px solid #676767;
-webkit-transition: all 0.15s ease-in;
transition: all 0.15s ease-in;
}
.select-options li.selected {
color: gray;
background: #fff;
}
.select-options li[rel="hide"] {
display: none;
}
ul.select-options {
max-height: 15em;
overflow-y: scroll;
overflow-x: hidden;
}
Run Code Online (Sandbox Code Playgroud)
并使用JS
function styleSelectMenu(selectMenu)
{
var $this = …Run Code Online (Sandbox Code Playgroud) java ×2
junit ×2
liquibase ×2
maven ×2
mockito ×2
testing ×2
arguments ×1
bundle ×1
changeset ×1
css ×1
gradle ×1
html-lists ×1
installation ×1
jquery ×1
jquery-ui ×1
json ×1
jstl ×1
mobile ×1
mysql ×1
perl ×1
plugins ×1
repository ×1
ruby ×1
service ×1
spring ×1
surefire ×1
unzip ×1
verify ×1