AnsweredAssumed Answered

Unit testing org.alfresco.repo.jscript.People.getPeople()

Question asked by muralidharand on Dec 24, 2015
Latest reply on Jan 21, 2016 by muralidharand
Hi Experts,

I am trying to do unit testing
 org.alfresco.repo.jscript.People.getPeople(String) 
method but I am getting, null pointer exception.

java.lang.NullPointerException
   at org.alfresco.repo.jscript.People.getPeoplePaging(People.java:572)
   at org.alfresco.repo.jscript.People.getPeople(People.java:559)
   at org.alfresco.repo.jscript.People.getPeople(People.java:539)
   at org.alfresco.repo.jscript.People.getPeople(People.java:522)
   at org.alfresco.repo.jscript.PeopleTest.testGetPeople(PeopleTest.java:110)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at junit.framework.TestCase.runTest(TestCase.java:176)
   at junit.framework.TestCase.runBare(TestCase.java:141)
   at junit.framework.TestResult$1.protect(TestResult.java:122)
   at junit.framework.TestResult.runProtected(TestResult.java:142)
   at junit.framework.TestResult.run(TestResult.java:125)
   at junit.framework.TestCase.run(TestCase.java:129)
   at junit.framework.TestSuite.runTest(TestSuite.java:255)
   at junit.framework.TestSuite.run(TestSuite.java:250)
   at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
   at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


After debugging I found that, "Context" is null during unit testing in
 org.alfresco.repo.jscript.People.getPeoplePaging(String, ScriptPagingDetails, String, Boolean)
.

Can you please guide me, how I can do the unit testing
 org.alfresco.repo.jscript.People.getPeople(String) 
method?

Thanks,
Murali

Outcomes