WireMock 的時候報錯:No response could be served as there are no stub mappings in this WireMock
環境:
idea
win10
問題描述:
使用wiremock讀取resources下的mock.json檔案,瀏覽器報錯
No response could be served as there are no stub mappings in this WireMock
程式碼如下
public void proxyMockTest(){
try {
stubFor(get(urlMatching(".*")).atPriority(10)
.willReturn(aResponse().proxiedFrom("https://www.baidu.com/")));
stubFor(get(urlEqualTo("categories_and_latest")).atPriority(1)
//通過json檔案修改指定網頁資訊
.willReturn(aResponse().withBody(Files.readAllBytes(Paths
.get(WireMockTest.class.getResource("/mock.json")
.toURI())))));
Thread.sleep(50000);
} catch (Exception e) {
e.printStackTrace();
}
報錯解決方案:
在resources檔案下增加mocks資料夾,那麼在上面的專案中,路徑變成resources/mocks/mock.json,即可解決
相關文章
- Mock工具wiremock-pyMockREM
- 使用Wiremock進行整合測試 - kubilayREMMock
- WireMock+renren-fast 快速搭建 HTTP Mock 視覺化平臺思路REMMockASTHTTP視覺化
- vagrant下composer安裝laravel-wechat時候,出現could not delete的錯誤Laraveldelete
- 誰遇到過執行 monkey 的時候報 filenotfound 的報錯
- oracle RAC dbca的時候報錯提示cluster nodes are not accessibleOracle
- 解決vue使用Sass時候的報錯問題Vue
- 今天在object-c 和swift 混編的時候出現錯誤:could not build module foundationObjectSwiftUI
- crontab 新增計劃任務的時候報錯疑問?
- pg_basebackup 報錯could not create directory
- 設定Ruby報錯bad response Not Found 404
- sshd啟動報錯Could not load host key
- Lumen 報錯提示 例項不了 Response 類的問題
- oracle 安裝的時候出現PRVF-0002 : could not retrieve local node nameOracle
- 使用android studio 建立app時報錯:Could not download junit.jar(junit:junit:4.12)AndroidAPPJAR
- hibernate配置級聯刪除時報錯:could not execute statement; SQL [n/a]; constraint [null]SQLAINull
- cmake報錯CMake Error: Could not find CMAKE_ROOTError
- go tool compile 報錯 could not import sync (file not found)GoCompileImport
- 安裝 dingo/api 報錯:Your requirements could not be resolvedGoAPIUIREM
- 配置 C3 工具時,修改/etc/host,再重新安裝叢集的時候報錯
- 在事件中實現 佇列的時候報錯請教一下事件佇列
- IDEA在執行maven打war的時候報錯:Cannot access defaults field of PropertiesIdeaMaven
- npm publish 釋出一個 Angular 庫的時候報錯以及解決方法NPMAngular
- homestead下安裝laravel報錯:Your requirements could not be...LaravelUIREM
- Could not initialize class sun.awt.X11GraphicsEnvironment 報錯
- java使用@Controller註解跳轉到thmyleaf頁面時候報錯JavaController
- appium 初始化安裝的時候報錯 Error getting strings.xml from apkAPPErrorXMLAPK
- Gradle專案Build的時候,頻繁報Unknown host 'jcenter.bintray.com' 錯誤GradleUI
- HAL stub
- MySQL 8.0版本連線報錯:Could not create coMySql
- Linux報錯:Could not get lock /var/lib/dpkg/lock-frontendLinux
- compoer 有時候報錯但看不出具體什麼問題。
- 【MybatisPlus】資料庫的datetime型別欄位為空的時候,報錯空指標?MyBatis資料庫型別指標
- 解決docker啟動映象報錯:docker: Error response from daemonDockerError
- hadoop啟動時,報ssh: Could not resolve hostname xxx: NamHadoop
- Electron打包的時候路徑出現問題!include: could not find: "C:UsersxxxxAppDataLocalTemp -TH3KzBAPP
- Git push時報錯:fatal: Could not read from remote repository. Please make sure you have the correct access rightsGitREM
- 09 對映(mappings)APP