I just try to make a nearby search request, filter the results and finally make a details search request for every place I got.
I do something like this:
GeoApiContext geoApiContext = new GeoApiContext().setApiKey("my_key");
NearbySearchRequest nearbySearchRequest = new NearbySearchRequest(geoApiContext);
PlaceDetailsRequest placeDetailsRequest = new PlaceDetailsRequest(geoApiContext);
try {
nearbySearchRequest.location(new LatLng(latitude, longitude)).radius(1000);
nearbySearchRequest.type(placeType);
PlacesSearchResponse placesSearchResponse = nearbySearchRequest.await();
Collections.addAll(places, placesSearchResponse.results);
} catch (Exception e) {
e.printStackTrace();
}
List<PlacesSearchResult> sortedPoints = filterPlaces(places);
LOGGER.info(sortedPoints.size());
try {
for (PlacesSearchResult result : sortedPoints) {
placeDetailsRequest.placeId(result.placeId);
PlaceDetails placeDetails = placeDetailsRequest.await();
objectOfInterests.add(convert(placeDetails));
}
} catch (Exception e) {
e.printStackTrace();
}
and here is the stack trace that prints the unit test:
abr 21, 2016 10:10:39 AM com.google.maps.GeoApiContext getWithPath
INFORMACIÓN: Request: https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=AIza...&location=-0.206238%2C-78.492243&radius=1000&type=lodging
abr 21, 2016 10:10:41 AM com.google.maps.GeoApiContext getWithPath
INFORMACIÓN: Request: https://maps.googleapis.com/maps/api/place/details/json?key=AIza...&placeid=ChIJd6N_BGma1ZERqZqNFkQ7hGU
10:10:41,416 INFO ObjectOfInterestService:77 - 3
java.lang.IllegalStateException: 'await', 'awaitIgnoreError' or 'setCallback' was already called.
at com.google.maps.PendingResultBase.makeRequest(PendingResultBase.java:74)
at com.google.maps.PendingResultBase.await(PendingResultBase.java:55)
at com.guide.services.ObjectOfInterestService.queryGoogleByInterestType(ObjectOfInterestService.java:81)
at com.guide.services.ObjectOfInterestServiceTest.testQueryGoogleByInterestType(ObjectOfInterestServiceTest.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
The for loop only executes one time but the list has 3 elements. The exception stop the execution of the for loop.
How can I solve this?
Try moving the PlaceDetailsRequest inside the loop. It is not re-usable.
try {
for (PlacesSearchResult result : sortedPoints) {
PlaceDetailsRequest placeDetailsRequest =
new PlaceDetailsRequest(geoApiContext);
placeDetailsRequest.placeId(result.placeId);
PlaceDetails placeDetails = placeDetailsRequest.await();
objectOfInterests.add(convert(placeDetails));
}
} catch (Exception e) {
e.printStackTrace();
}
Related
im trying to write JUnit for the following method, which works perfectly when Im executing the method normally, but while invoking the Unit tests, it throws RetriesExhaustedException in result.get().
Method to be Tested:
#Override
public Event findEvents(String id) throws IOException {
Table eventsTable = null;
Connection connection = null;
Event event = null;
boolean iFlag = false;
boolean aFlag = false;
boolean fFlag = false;
try {
connection = connectionPool.get();
eventsTable = connection.getTable(TableName.valueOf(configuration.getEventsTable()));
Get g = new Get(Bytes.toBytes(id.replaceAll(STRPATTERN, "")));
Result r = eventsTable.get(g);// Exception occurs throwing RetiresExhaustedException
if (!r.isEmpty()) {
event = genericRowRowMapperMapper.mapEventDetails(r, HbaseConstants.getEventheaderCf1(),
HbaseConstants.getEventbodyCf1(), iFlag, aFlag, fFlag);
Util.replaceAid(event, id);
}
} finally {
CGUtil.closeTable(eventsTable);
releaseConnection(connection);
}
return event;
}
Test Method:
#Test(expected = Exception.class)
public void findEventsTest() throws Exception {
String flexid = "25652365";
Map<String, Event> eventMapF = new HashMap<>();
Event eventF = new Event();
Activity activityF = new Activity();
activityF.setId("25652365");
eventF.setActivity(activityF);
eventMapF.put("25652365", eventF);
Event evF = hBaseRepository.findEvents(flexid);
assertNull(evF);
}
Stack Trace:
org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=3, exceptions:
Wed Jan 08 12:35:36 IST 2020, RpcRetryingCaller{globalStartTime=1578467135791, pause=1000, retries=3}, java.lang.AssertionError
Wed Jan 08 12:35:37 IST 2020, RpcRetryingCaller{globalStartTime=1578467135791, pause=1000, retries=3}, java.lang.AssertionError
Wed Jan 08 12:35:40 IST 2020, RpcRetryingCaller{globalStartTime=1578467135791, pause=1000, retries=3}, java.lang.AssertionError
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:164)
at org.apache.hadoop.hbase.client.HTable.get(HTable.java:867)
at org.apache.hadoop.hbase.client.HTable.get(HTable.java:832)
at com.citi.gcb.cg.repository.HbaseNativeRepository.findEvents(HbaseNativeRepository.java:103)
at com.citi.gcg.cg.repository.HbaseNativeRepositoryTests.findEventsTest(HbaseNativeRepositoryTests.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.AssertionError
at org.apache.hadoop.hbase.client.ClientScanner.loadCache(ClientScanner.java:484)
at org.apache.hadoop.hbase.client.ClientScanner.next(ClientScanner.java:312)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1327)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1224)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1208)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1165)
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getRegionLocation(ConnectionManager.java:997)
at org.apache.hadoop.hbase.client.HRegionLocator.getRegionLocation(HRegionLocator.java:71)
at org.apache.hadoop.hbase.client.RegionServerCallable.prepare(RegionServerCallable.java:87)
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:140)
I tried changing the increasing rpc timeout property from hbase-site.xml file but still the test case is not passing, its throwing the same exception.
I'm attempting to download a JSON file and save it to a local directory. The directory (/data/provisioning) already exists and has been given 776 (u=rwx,g=rwx,o=rw) as its permissions. The parent directory (/data) has also been given 776 permissions.
I'm using the Apache Commons FileUtils.copyURLToFile(..) method to download the file, like this:
String filePathToSave = "/data/provisioning/nexus_contents.json";
String url = "http://repository.obfuscated.com/nexus/url/to/json/file";
try {
FileUtils.copyURLToFile(
new URL(url)
, new File(filePathToSave),
5000,
5000);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
However, to my surprise, I'm getting this error:
java.io.IOException: Directory '/data/provisioning' could not be
created at
org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:356)
at
org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:319)
at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1552)
at
org.apache.commons.io.FileUtils.copyInputStreamToFile(FileUtils.java:1528)
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1506)
at
deployment.download.Downloader.getAndSaveNexusJSON(Downloader.java:26)
at
deployment.test.DeploymentTest.downloader_get_Nexus_JSON(DeploymentTest.java:424)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at
org.junit.runners.ParentRunner.run(ParentRunner.java:309) at
org.junit.runner.JUnitCore.run(JUnitCore.java:160) at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
What am I missing here?
Getting NullPointerException while running a JUnit test. I have already mocked the ClientHttpResponse class. Not sure what else I am missing.
Error:
java.lang.NullPointerException
at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:75)
at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:50)
at com.tss.payhub.template.rest.client.CustomResponseErrorHandler.hasError(CustomResponseErrorHandler.java:20)
at com.tss.payhub.template.rest.client.test.CustomResponseErrorHandlerTest.testHasError(CustomResponseErrorHandlerTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
CustomResponseErrorHandlerTest.java
public class CustomResponseErrorHandlerTest {
#Mock
ClientHttpResponse response = Mockito.mock(ClientHttpResponse.class);
#Test
public void testHasError() throws IOException {
CustomResponseErrorHandler instance = new CustomResponseErrorHandler();
boolean blnVal = instance.hasError(response);
assertTrue(blnVal);
}
}
CustomResponseErrorHandler.java (Class Under Test)
#Component
public class CustomResponseErrorHandler implements ResponseErrorHandler {
private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();
public boolean hasError(ClientHttpResponse response) throws IOException {
return errorHandler.hasError(response);
}
}
Try adding #RunWith(EasyMockRunner.class) to your test class:
#RunWith(EasyMockRunner.class)
public class CustomResponseErrorHandlerTest {
I am trying to autopost a crystal report in PDF formate.
I am using IDE: IntelliJ Gradle
public void runApprovedSupplierSiteReport(){
// final Config config = ConfigFactory.instance(Config.class);
//CrystalUtil.setupJdbcJndi(Config.getDatabaseServer(), Config.getDatabaseUsername(), Config.getDatabasePassword(), Config.getDatabaseJdbcDriver(), Config.getDatabaseJdbcUrl());
final List<String> paramNames = Config.getMatches(APPROVED_SUPPLIER_SITE_PARAM_REGEX);
final Map<String, String> params = new HashMap<>();
for (final String name : paramNames) {
final String value = Config.getPqp_Report_ApprovedSupplierSite_Param_$0_Value(name);
params.put(name, value);
}
final ReportClientDocument reportDoc = new ReportClientDocument();
try {
// export PDF
final String report = Config.getPqp_Report_ApprovedSupplierSite_Rpt();
reportDoc.open(report, OpenReportOptions._openAsReadOnly);
CrystalUtil.setParamFields(reportDoc, params);
final InputStream is = reportDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//
final Session session = CmisUtil.createSession(Config.getPdmsAtomPubUrl(), Config.getPdmsUser(), Config.getPdmsPassword(), Config.getPdmsRepositoryId());
final Map<String, Object> properties = DocumentManager.getDocumentProperties(
DocType.SUPPLIER_REPORTS,
DocGroup.MQPSD,
SUPPLIER_REPORT_DOC_NUMBER,
SUPPLIER_REPORT_NAME,
new Date());
final String prefix = ConfigUtil.getEnvironmentPrefix(Config.getTwsEnvironmentCode());
final String docName = prefix + String.format(DocFormat.SUPPLIER_REPORTS, PdmsUtil.getDateAsString(new Date()));
final Document document = CmisUtil.createDocument(
session,
docName + ".pdf",
"",
docName,
DocClass.REPORTS,
MediaType.PDF.toString(),
is,
-1,
properties);
Monitor.getLogger().info("<- PDMS report=" + report + " id=" + document.getId() + " versionSeriesId=" + document.getVersionSeriesId());
} catch (final ReportSDKException e) {
String err = e.getMessage();
Monitor.getLogger().error("runApprovedSupplierSiteReport() " + e.getMessage());
logger.error("runApprovedSupplierSiteReport()", e);
} catch (final CmisBaseException e) {
Monitor.getLogger().error("runApprovedSupplierSiteReport() " + e.getErrorContent());
logger.error("runApprovedSupplierSiteReport()", e);
} finally {
CrystalUtil.closeQuietly(reportDoc);
}
}
In above code snippet at line reportDoc.open(report, OpenReportOptions._openAsReadOnly); I got following error :
java.lang.AbstractMethodError: com.businessobjects.reports.sdk.JRCCommunicationAdapter.setProductLocale(Ljava/util/Locale;)V
at com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.new(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.new(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(Unknown Source)
at com.crystaldecisions.reports.sdk.ReportClientDocument.open(SourceFile:80)
at com.processstream.pepsico.pqp.tws.ows.PqpOwsJob.runApprovedSupplierSiteReport(PqpOwsJob.java:264)
at com.processstream.pepsico.pqp.tws.ows.PqpOwsJobTest.runApprovedSupplierSiteReport_1(PqpOwsJobTest.java:36)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
I have checked for all abstract classes but all the methods are defined. Please let me know if anybody can help me in solving this error.
void com.businessobjects.reports.sdk.JRCCommunicationAdapter.setProductLocale(Locale)
This method is concrete in the version of the library you used to compile your code, so your IDE was happy to compile a call reference to it.
The library present in the deployment location is a different version in which this method is abstract.
This is described in the Javadoc for AbstractMethodError:
Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled.
Trying to add all MIME messages in a POP3 inbox to a LinkedBlockingQueue:
inbox = pollStore.getFolder("INBOX");
inbox.open(Folder.READ_WRITE);
for (int i = 0; i < inbox.getMessageCount(); i++) {
Message messageI = inbox.getMessage(i+1);
if (messageI != null ) {
MimeMessage mimeMessageI = (MimeMessage) messageI;
inboxQueue.add(mimeMessageI);
messageI.setFlag(Flags.Flag.DELETED, true);
}
}
However I get java.lang.NullPointerException error upon running a tester class, which otherwise works. What could be the problem?
at com.tutorgami.relay.email.EmailFetchClient.poll(EmailFetchClient.java:147)
at com.tutorgami.relay.RelayIntegrationTest1.testSendingAndReceiving(RelayIntegrationTest1.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
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:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)