« first day (3770 days earlier)      last day (1395 days later) » 

00:00
Swap read error. You lose your mind. (source)
 
5 hours later…
04:53
fights crime
 
3 hours later…
08:06
Hi
I am facing some issue while doing code coverage of junits
it is not coming as 100%
public class AppTest {


public void test() throws Exception {
try {
getSleepTimeDetails();
//System.out.println("hellol.....");}
}
catch(Exception ex) {
throw new Exception();
}
}


void getSleepTimeDetails() throws Exception {
System.out.println("hello...");
throw new Exception();
}
}
public class TestApp {


@Test(expected = Exception.class)
public void testApplication() throws Exception {

AppTest appTest = new AppTest();
appTest.test();
}
}
can anyone help me how to write junits for this
how to improve code coverage for that junit
08:37
which code is not covered?
what code is covered?
what tests do you have?
(or only that one test that expects an exception?)
 
1 hour later…
09:52
AAARRRRGGHHHH AYE JAVA PLEBS!
@Zoe not unique to Java
* feels as Jack on a remote island *
fortunately there's a secret stash of rum!
(if you do not get it, go watch Pirates of Caribbean you fools)
Zoe
Zoe
@KarelG even C++ has string1 == string2
10:24
@wietol
in code coverage I am not getting 100%
yes
it will be appreciate if you provide any information to us
Zoe
Zoe
@Pani No one can tell you anything unless you show some code
public class AppTest {


public void test() throws Exception {
try {
getSleepTimeDetails();
//System.out.println("hellol.....");}
}
catch(Exception ex) {
throw new Exception();
}
}


void getSleepTimeDetails() throws Exception {
System.out.println("hello...");
throw new Exception();
}
getSleepTimeDetails();--->here I am facing issue
it is showing as red mark
even though code is executed
public class TestApp {


@Test(expected = Exception.class)
public void testApplication() throws Exception {

AppTest appTest = new AppTest();
appTest.test();
}
this is the junit class
please let me know how to improve the code coverage
Zoe
Zoe
It's not 100% because the catch is never invoked
Nope, it does
Never mind :kek:
10:50
it is not 100% because it never succeeds without an exception
not sure if that could be considered a bug in the coverage algo though
@Wietlol the catch is invoked and I am athrowing an exception in code
jnit is working without any issue
only the issue is code coverage
it is not covering 100%
may i know the actual issue here
the coverage you are missing is when "getSleepTimeDetails()" doesnt throw an exception
or when it throws something that is not a subclass of Exception
perhaps
but that is a separate case
2
Q: EclEmma fails to count method that throws an exception as covered

redboyI am not getting to the 100% code covered and would like to. Unless I see the 100% green I wonder what I forget to test and go hunting only to find out silly things based on the tool and not my test are keeping me from it. Then later I forget and have to rinse/repeat. While all paths are covere...

@Zoe yeah, wish that java has templates that allow operator overrides
 
3 hours later…
14:00
posted on February 17, 2021

archive - contact - sexy exciting merchandise - search - about ← previousFebruary 17th, 2021nextFebruary 17th, 2021: Hey, I've got a mailing list for SECRET PALS! If you'd like to be a SECRET PAL, baby, now is your chance. I only send out a message like once a month!– Ryan

 
6 hours later…
20:00
uses java.io.File

« first day (3770 days earlier)      last day (1395 days later) »