- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
在 IntelliJ IDEA 15.0.2 中,如何在测试覆盖率测量期间忽略琐碎的 getter 和 setter(琐碎方法)?
// should be measure
public void complex() {
fancy();
interesting();
dropDatabase();
}
// should not be measured
public int getNumber() {
return this.number;
}
测量每一行会得到 75%。仅用上述方法测量结果为 100%。这些是 100% 可用于测试的代码。
为什么我在 Internet 上找不到任何相关信息?我是否陷入了不良做法?
更新
此代码也有资格进行测试:
// should also be tested as it contains logic
public Integer getValidationProgress() {
if (validationProgress == null) {
validationProgress = 0;
}
return validationProgress;
}
最佳答案
JetBrains 告诉我目前不可能。
Andrey Dernov (IntelliJ) Jan 6, 22:54
Hello Michael,
There is no setting to ignore a certain method.
我创建了一个 issue为此。
关于java - IntelliJ IDEA : ignore trivial methods in code coverage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34417548/
我被要求编写一个递归代码来打印一个数组。一位 friend 向我展示了这段代码: include int i=0; void print(int A[], int n) { if(i voi
我正在尝试让 google 的示例(应用内购买 version 3)测试应用“TrivialDrive”正常工作,但遇到以下问题: 我点击“buy gas”按钮,出现以下屏幕: 此消息有两种可能的解释
我知道这是一个非常常见的主题,但尽管典型的 UB 很容易找到,但到目前为止我还没有找到这个变体。 因此,我尝试正式引入 Pixel 对象,同时避免数据的实际拷贝。 这有效吗? struct Pixel
当一个函数接受一个函数参数(或者一个类有一个函数槽)时,有两种方法可供选择: def foo(..., my_func=None, ...): ... if my_func:
你知道任何 git 命令的工具/开关可以帮助我防止冲突或加速 merge 吗? 目前我经常遇到这样的“琐碎的冲突”: ++>>>>>> 587f917... 我想这是由一些空格引起的。这很容易被人类解
我在国际象棋引擎上工作了一段时间。为了改进引擎,我编写了一些代码,将国际象棋位置从内存加载到一些调谐器代码中。我的机器上大约有 1.85B fens,加起来达到 40Gb(每个位置 24B)。 加载后
我想在 Spark 中加入两个数据集。这就是我所做的: Dataset data = spark.read().format("parquet").load("hdfs://path"); Datas
我在国际象棋引擎上工作了一段时间。为了改进引擎,我编写了一些代码,将国际象棋位置从内存加载到一些调谐器代码中。我的机器上大约有 1.85B fens,加起来达到 40Gb(每个位置 24B)。 加载后
根据我对标准的理解,普通析构函数是一种隐式声明的析构函数,其类只有基本和非静态成员以及普通析构函数。鉴于此定义的递归性,在我看来,唯一的“递归停止”条件是找到具有非隐式声明的析构函数(即用户声明的)的
在 C++0x 中,我想确定一个类是否简单/是否具有标准布局,以便我可以使用 memcpy()、memset() 等... 我应该如何使用 type_traits 实现下面的代码,这样我才能确认一个类
我有一个带有“日期”列的表,我想做一个执行以下操作的查询: 如果日期是 星期一 , 周二 , 周三 , 或 星期四 , 显示的日期应该上移 1 天,如 DATEADD(day, 1, [Date])
我有一个非常复杂的项目(大约 100 个模块),我想在它上面运行 mvn dependency:tree .它失败了,提示它无法解决的依赖关系。该项目否则编译得很好。所以我创建了我能想到的最基本的项目
我希望这会返回一个 Date 对象,表示从现在开始一小时后的时间: Calendar.current.date(byAdding: DateComponents(hour: 1), to: Date(
Blocksworld显然是自动化规划中的基准领域。 This domain consists of a set of blocks, a table and a robot hand. The bl
我是 Angular 新手,我想做一些重要的输入验证。 基本上我有一张 table 。每行包含三个文本输入。当用户输入任何文本输入时,我想检查该表是否至少包含一行具有三个非空白输入字段。如果是的话
我无法理解导致索引错误的原因,而不是寻找快速修复。但是,如果我的代码让您反感/非常无效,请告诉我。目标是生成由两个四位数的乘积产生的回文。 代码: for x in range(10000):
我有一些数据需要多个 Activity 操作。基本上有一个只读屏幕和多个编辑屏幕。 起初我考虑将数据作为字符串参数传递给 Intent,但如果用户在编辑字段后按下后退按钮,这些更改将会丢失。 那么在不
我会定义“平凡可 move ” Calling the move constructor (or the move assignment operator) is equivalent to memc
我只想 class Trivial t instance Trivial t 这在 Haskell 98 中当然没用,因为你可以忽略约束;但使用 ConstraintKinds,我们可以明确要求类型为
在 future 的 C++ 标准中,我们将拥有“平凡的可重定位性”的概念,这意味着我们可以简单地将字节从一个对象复制到未初始化的内存块,并简单地忽略/清零原始对象的字节。 这样,我们就模仿了 C 风
我是一名优秀的程序员,十分优秀!