Hi Evgeny,

*Thanks for the quick reply*

To explain further regarding the above issue , here is the small example.

*These are two public java classes .*

*Class A:*

public class A(){
      int a;
      public A(){}

      public int Method1(){
               a=10;
               return a;
         }
}

*Class B:*

public class B(){
       int b;
       private A object_of_a;

       public B(){}
       
       public int method2(){

                int c= object_of_a.Method1();
                b=b+c;
                return c;
       }
}


*This is a Unit Test Class which is written for Class B. In this unit test 
case i m using Jmockit for mocking some of the methods.  *

In the Below Test Case i m mocking the method Method1() of Class A using 
Jmockit and I use Jacoco agent to run the test case.

import org.testng.annotations.Test;
import org.junit.runner.RunWith;
import mockit.MockUp;
import mockit.Mock;

@Test
@RunWith(JMockit.class)
public class Test_B(){

       public Test_B(){}
       
       @BeforeClass
        public void setup() throws Exception {
        }

        @Test
         public void test_method2(){
                     
                  *   new MockUp(A){        < -- 10 ( Here i get Exception) 
*
                          @Mock
                          public int Method1(){
                                   return 1290;
                           }   
                     };
                    
                    B b = new B();
                    int res = b.method2();
         }
}


*Now , I execute my Test Case **Test_B()*. For this i use *jacoco - maven 
-plugin 0.7.9* and *Jmockit version 1.28*.

When i execute the testcase with these two configuarations , My testcase is 
getting failed at Line 10 which is mentioned above with the exception*  -- 
> "**java.lang.UnsupportedOperationException: class redefinition failed: 
attempted to change the schema (add/remove fields)".*

And,if i remove Jacoco plugin and just execute the test case as a normal 
test case without any jacoco agent in the command and using just jmockit 
version, It's works fine without any exception. So i m facing this issue 
when both jacoco and jmockit are used together. 

*I want to know how to solve this conflct or is this a bug in Jacoco 
version 0.7.9 which is not working fine with other plugins like Jmockit.*

Thanks,
-Praveen

On Tuesday, 13 June 2017 14:59:04 UTC+5:30, Evgeny Mandrikov wrote:
>
> Hi,
>
> To speedup understanding of your issue, please provide minimalistic 
> example of project demonstrating this.
>
> Regards,
> Evgeny
>
> On Tuesday, June 13, 2017 at 10:51:05 AM UTC+2, Praveen S P wrote:
>>
>> Hi Everyone ,
>>
>> I m using Jacoco (Version : 0.7.9)  for Code Coverage and Jmockit 
>> (Version :1.28) for Mocking purpose while running my unit test cases. But 
>> is see a peculiar exception when execute my test cases with this 
>> combination of Jacoco and Jmockit.
>>  
>> Here is the Exception :
>> "*java.lang.UnsupportedOperationException: class redefinition failed: 
>> attempted to change the schema (add/remove fields)".*
>>
>> I have used jmockit for mocking in my unti testcases. I see this 
>> exception in only those test cases where Jmockit mocking being used. Other 
>> Test cases which does not use any jmockit mocking are going fine.Hence this 
>> is a issue between jmockit and jacoco. I was trying to solve this issue for 
>> long time. I tried changing maven surefire plugin version, and  i saw that 
>> in this link "http://www.jacoco.org/jacoco/trunk/doc/changes.html"; that 
>> this same issue has been solved in 0.7.3 .So i downgraded the version from 
>> 0.7.9 to 0.7.3 .But this also could not solve the issue . 
>>
>> As per my understanding , there is a conflict when we use jacoco and 
>> jmockit simultaneously . So i want to know how to solve this issue and what 
>> is the solution for the conflict between jacoco and Jmockit.
>>
>> *can anyone help me on this ..Please..!! *
>>
>>
>> Thank You
>> -Praveen
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/6d6f9dc7-024f-41bc-aa86-ec21c12058ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to