Hi Sivaramya, You dont have to mock the whole carbon context here. You can send a mock payload when the particular method is called.
Are you using powerMock + mockito if so do as the document sample in [1]. [1]. https://github.com/searls/mockito-testng-example/blob/master/presentation/Mockito.pdf Thank you, Dharshana. On Wed, Oct 4, 2017 at 9:55 PM, Malaka Silva <[email protected]> wrote: > +Dharshana > > On Wed, Oct 4, 2017 at 8:26 PM, Sivaramya Sivanathan <[email protected]> > wrote: > >> Hi all, >> >> Currently I am working on the unit testing for the esb-connector-jms >> extension. For that I need to mock the CarbonContext for the method >> CarbonContext.getThreadLocalCarbonContext().getTenantId(). But, I'm >> unable mock the CarbonContext. >> Can any one suggest me how can we mock the CarbonContext? >> >> Thanks, >> Sivaramya Sivanathan >> Associate Software Engineer | WSO2 >> Tel: 0770874960 <077%20087%204960> >> WSO2 Inc : http://wso2.org >> <http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg> >> LinkedIn | www.linkedin.com/in/sivaramya >> > > > > -- > > Best Regards, > > Malaka Silva > Associate Director / Architect > M: +94 777 219 791 <077%20721%209791> > Tel : 94 11 214 5345 > Fax :94 11 2145300 <011%202%20145300> > Skype : malaka.sampath.silva > LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77 > Blog : http://mrmalakasilva.blogspot.com/ > > WSO2, Inc. > lean . enterprise . middleware > https://wso2.com/signature > http://www.wso2.com/about/team/malaka-silva/ > <http://wso2.com/about/team/malaka-silva/> > https://store.wso2.com/store/ > > Don't make Trees rare, we should keep them with care > -- Dharshana Warusavitharana Associate Technical Lead WSO2 Inc. http://wso2.com email : [email protected] <[email protected]> Tel : +94 11 214 5345 Fax :+94 11 2145300 cell : +94770342233 blog : http://dharshanaw.blogspot.com lean . enterprise . middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
