小编Blu*_*e16的帖子

运行单元测试时出现IntelliJ错误:无法找到或加载主类$ {surefireArgLine}

在IntelliJ中运行单元测试时出现以下错误:错误:无法找到或加载主类$ {surefireArgLine}.我正在使用maven,在pom.xml中我有:

<properties>
    ...
    <surefire.argLine />
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>apt-maven-plugin</artifactId>
            <version>1.1.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/generated-sources/java</outputDirectory>
                        <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
             <!--Sets the VM argument line used when unit tests are run.-->
            <argLine>${surefire.argLine}</argLine>
        </configuration>
    </plugin>
  <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.1.201405082137</version>
            <executions>
                <!--
                    Prepares the property pointing to the JaCoCo runtime agent which
                    is passed as VM argument when Maven the Surefire plugin is executed.
                -->
                <execution>
                    <id>pre-unit-test</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                    <configuration>
                        <!--Sets …
Run Code Online (Sandbox Code Playgroud)

junit intellij-idea maven-surefire-plugin

61
推荐指数
2
解决办法
3万
查看次数

在Eclipse和Maven2中运行测试时,JUnit 4 PermGen大小溢出

我正在使用JUnit,PowerMock和Mockito进行一些单元测试.我有很多测试类注释@RunWith(PowerMockRunner.class)@PrepareForTest(SomeClassesNames)模拟最终类和200多个测试用例.

最近,当我在Eclipse或Maven2中运行我的整个测试套件时,我遇到了PermGen空间溢出的问题.当我逐个运行我的测试时,他们每个都成功.

我做了一些关于这方面的研究,但没有一个建议对我有帮助(我增加了PermGenSize和MaxPermSize).最近我发现有一个类只包含静态方法,每个方法返回用PowerMockito模拟的对象.我想知道这是否是一个好习惯,也许这是问题的根源,因为静态变量是在单元测试之间共享的?

一般来说,拥有一个带有许多返回静态模拟对象的静态方法的静态类是一个好习惯吗?

junit static permgen mockito powermock

9
推荐指数
3
解决办法
2万
查看次数

将两个表从第一个日期开始连接到第二个日期范围内

我有两个如下表(日期格式:yyyy-MM-dd):
1)Table1 - EMPLOYEE_OVERTIMES(别名:EO)

EMPLOYEE_ID | OVERTIME_DATE
------------------------------------------------
1           | 2012-04-01
2           | 2012-08-14
3           | 2012-07-22
4           | 2012-10-30
5           | 2012-06-07
Run Code Online (Sandbox Code Playgroud)

2)表2 - EMPLOYEE_HOLIDAYS(别名:EH)

EMPLOYEE_ID | START_DATE | END_DATE   |
-----------------------------------------
1           | 2012-03-28 | 2012-04-10
2           | 2012-01-14 | 2012-01-30
3           | 2012-07-15 | 2012-07-25
4           | 2012-10-10 | 2012-10-13
5           | 2012-06-01 | 2012-06-07
Run Code Online (Sandbox Code Playgroud)

表 EMPLOYEE_OVERTIMES 和 EMPLOYEE_HOLIDAYS 是从其他表联接的。我想查找满足以下条件的所有记录:EH.START_DATE <= EO.OVERTIME_DATE <= EH.END_DATE

3)结果表

EMPLOYEE_ID | START_DATE | END_DATE   | OVERTIME_DATE
-------------------------------------------------------
1           | 2012-03-28 | …
Run Code Online (Sandbox Code Playgroud)

sql sql-server join date intervals

5
推荐指数
1
解决办法
1万
查看次数