[Code] java quiz



First
Look at the following test code:

@Test
public void quiz1() throws Exception {
assertEquals(9, 01 + 08);
}
The result is:
1) green bar
2) red bar
3) doesn't compile
4) it throws an exception






Second


@Test
public void quiz2() throws Exception {
Integer x = 1288;
Integer y = 1288;
assertTrue(x == y);
int z = 1288;
assertTrue(x == z);
}

1) first assert red, second green
2) green, red
3) green, green
4) red, red
5) doesn't compile
6) it throws an exception

2 commenti:

fabio boldrini ha detto...

nel secondo la risposta dipenda dalla versione di JAVA

Unknown ha detto...

AFAIK if the first assert fails we actually should never reach the second assert...