小编Woj*_*ski的帖子

从多个模块一起在IntelliJ IDEA中运行单元测试

如何一次运行两个或多个IDEA模块的所有测试?

我使用了很多模块,经常运行所有单元测试非常重要,当我选择运行多个文件夹时,上下文菜单上就没有"运行"选项了.

testing intellij-idea

76
推荐指数
4
解决办法
3万
查看次数

属于特征的对象传染媒介

请考虑以下代码:

trait Animal {
    fn make_sound(&self) -> String;
}

struct Cat;
impl Animal for Cat {
    fn make_sound(&self) -> String {
        "meow".to_string()
    }
}

struct Dog;
impl Animal for Dog {
    fn make_sound(&self) -> String {
        "woof".to_string()
    }
}

fn main () {
    let dog: Dog = Dog;
    let cat: Cat = Cat;
    let v: Vec<Animal> = Vec::new();
    v.push(cat);
    v.push(dog);
    for animal in v.iter() {
        println!("{}", animal.make_sound());
    }
}
Run Code Online (Sandbox Code Playgroud)

编译器告诉我这vAnimal我尝试推送时的向量cat(类型不匹配)

那么,我如何制作属于特征的对象向量并在每个元素上调用相应的特征方法呢?

polymorphism rust

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

通过给定的泛型类型Scala获取类的伴随对象

我想要做的是创建一个函数,它将采用泛型类并在其中使用静态方法(对不起Java语言,我的意思是它的伴随对象的方法).

trait Worker {def doSth: Unit}

class Base

object Base extends Worker

// this actually wouldn't work, just to show what I'm trying to achieve
def callSthStatic[T that companion object is <: Worker](implicit m: Manifest[T]) {
  // here I want to call T.doSth (on T object)
  m.getMagicallyCompanionObject.doSth
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

types scala class object implicit

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

Android单元测试 - 没有这样的属性:bootClasspath

我正在尝试为刚刚宣布的单元测试支持执行简单的Android测试用例 - http://tools.android.com/tech-docs/unit-testing-support

在仔细跟随演练之后,我正试图运行./gradlew test.我收到这个错误:

Execution failed for task ':app:compileDebugGroovy'.
> No such property: bootClasspath for class: com.android.build.gradle.AppPlugin
Run Code Online (Sandbox Code Playgroud)

使用时com.android.tools.build:gradle:1.1.0-rc1.

还有其他人被困在那吗?

android unit-testing gradle android-gradle-plugin

19
推荐指数
1
解决办法
5679
查看次数

Gradle:如何将自定义JAR文件上载到Maven存储库

我在不使用Gradle Jar任务的情况下构建了一个jar文件(我需要在我的任务中使用Ant任务).如何配置uploadArchives以便能够在指定的存储库中安装JAR.

我试图用.覆盖默认工件

uploadArchives {
    repositories {
        mavenDeployer {
            // some Maven configuration
        }
    }
}

artifacts {
    archives file: file('bin/result.jar')
}
Run Code Online (Sandbox Code Playgroud)

但我收到一个错误,可能没有2个具有相同类型和分类器的工件,这意味着此配置增加了覆盖配置.

jar gradle maven

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

Intellij IDEA项目中的自定义构建步骤

每次Intellij运行Make时,我都需要执行一个外部工具.在eclipse中我可以很容易地修改构建步骤,但我不知道如何实现这一点.

有任何想法吗?

我希望它能够使用外部脚本处理我的资源,而无需在每次测试运行之前手动运行它.

build intellij-idea custom-build-step

12
推荐指数
1
解决办法
5428
查看次数

如何更改Play2正在侦听的HTTP端口

文件说:

$ play start

注意:可以通过传递-Dhttp.port系统变量来设置HTTP端口

但我仍然遇到9000端口错误

$ /opt/play-2.0/play start -Dhttp.port=9001

[info] Loading project definition from /my/path
[info] Set current project to marmurka (in build file:/my/path/)

(Starting server. Type Ctrl+D to exit logs, the server will remain in background)

Play server process ID is 27505
[info] play - Application started (Prod)
Oops, cannot start the server.
org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:9000
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:298)
    at play.core.server.NettyServer.<init>(NettyServer.scala:63)
    at play.core.server.NettyServer$.createServer(NettyServer.scala:131)
    at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:153)
    at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:152)
    at scala.Option.map(Option.scala:133)
    at play.core.server.NettyServer$.main(NettyServer.scala:152)
    at play.core.server.NettyServer.main(NettyServer.scala)
Caused by: java.net.BindException: …
Run Code Online (Sandbox Code Playgroud)

netty playframework playframework-2.0

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

用于单元测试的Intellij IDEA fork模式减慢了速度

我在Intellij IDEA中运行了9个JUnit(实际上是Spockframework)测试.大约需要3秒钟.

我想利用所有核心,因此我切换测试配置fork模式 - 类. Edit configurations > Fork mode > class

这会导致构建时间增加到8秒.尝试使用fork模式方法使它成为22秒.测试运行程序过程看起来像是按顺序运行而不是并行运行.

关于为什么不分支测试按预期工作的任何想法?

java groovy unit-testing intellij-idea spock

9
推荐指数
1
解决办法
3259
查看次数

从Intellij IDEA开始慢速Grails测试

每当我不想进行单一测试时,IDEA就会启动一个新的Grails实例.

有没有办法使用常规的Grails运行器,但使用交互模式?以交互模式运行测试快速开始:-)

testing grails unit-testing intellij-idea

7
推荐指数
1
解决办法
1101
查看次数

如何将scala中的两种类型组合成单一类型定义

这显示了我正在尝试做的事情:

type MyType = Value with MyTypeOperations
Run Code Online (Sandbox Code Playgroud)

但这不编译.还有另外一种方法可以将两种类型混合成一种吗?

types scala mixins

-1
推荐指数
1
解决办法
731
查看次数