我没有找到一种方法来执行称为“LocalBackendServiceTestConfig”的东西......从这个页面查看这个 - https://developers.google.com/appengine/docs/java/tools/localunittesting/javadoc/com/google /appengine/tools/development/testing/package-tree。好像没有。。。
所以,如果我有像这样在我的 JUnit 中运行的代码片段:
TaskOptions taskOptions = TaskOptions.Builder.withUrl(PageConstant.PROCESS_CSV_FILE)
.param("blobId", blobId)
.param("drive", csvUploadFileModel.getDriveStatus())
.param("sites", csvUploadFileModel.getSitesStatus())
.header("Host", BackendServiceFactory.getBackendService().getBackendAddress("backend-1"))
.method(Method.POST);
它会抛出这个异常:
Caused by: java.lang.NullPointerException
at com.google.appengine.api.backends.BackendServiceImpl.getDevAppServerLocalAddress(BackendServiceImpl.java:70)
at com.google.appengine.api.backends.BackendServiceImpl.getBackendAddress(BackendServiceImpl.java:43)
知道如何解决这样的问题吗?