In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to simulate the use of the interface tool moco in Java development. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.
The use scenario of Analog Interface tool moco in Java Development
In development, you need to rely on some interfaces, such as requesting an interface that returns Json data, but the interface that returns Json data is either not built or the interaction is complex.
At this point, you can use moco to simulate the interface to return interface data for development and testing.
Realize
First open the Github of moco, and then download the jar package locally
Then create a new foo.json in the same directory as the jar package
[{"response": {"text": "badao"}}]
Then open the command line in this directory and enter:
Java-jar moco-runner-1.0.0-standalone.jar http-p 12306-c foo.json
Note that the version of the jar package here should be the same as that of your own jar package, which is 1.0.0
If the requested text is in Chinese, in order to prevent the browser from garbled, you need to modify the json file to
[{"response": {"text": "overbearing hooligan temperament", "headers": {"Content-Type": "text/html;charset=gbk"}]
Then run the above command line command
Then open a browser and enter:
Http://localhost:12306
What is Java? Java is an object-oriented programming language that can write desktop applications, Web applications, distributed systems, and embedded system applications.
The above is how to simulate the use of the interface tool moco in Java development. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.