土库斯,为什么我拿到“方法主张(标准、目标、目标)”这一日特尼特测试的“理论试验”错误不明确?
@Test
public void testEditCard() {
Integer a = 10;
Integer b = 12;
Integer c = 2;
assertEquals("test", a-b, c);
}
添加以下文字:assertEquals(”test”,(Integer)(a-b),c);
解决问题。
土库斯,为什么我拿到“方法主张(标准、目标、目标)”这一日特尼特测试的“理论试验”错误不明确?
@Test
public void testEditCard() {
Integer a = 10;
Integer b = 12;
Integer c = 2;
assertEquals("test", a-b, c);
}
添加以下文字:assertEquals(”test”,(Integer)(a-b),c);
解决问题。
由于汽车箱和零箱的奇迹:
assertEquals("test", /* this is an int */ a-b, /* this is an Integer */ c);
能够评价
assertEquals(String, long, long);
// in this case the second parameter is unboxed
// (and the first one silently casted)
或
assertEquals(String, Object, Object);
// in this case the first parameter is boxed
如果你宣布所有变量为隐蔽(而不是 Integer),就不应含糊不清。
这是因为汇编者可以告诉你是否希望打上<条码>。 由于a-b
和c
可自动胁迫至long
,汇编者看到了一个模糊之处。
你明确告诉汇编者,你想要的是目标版本。
请注意,在这种情况下,你可以使用<代码>int而不是Integer
变量,这些变量也将确定模棱两可之处。
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...