Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 645017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:27:22+00:00 2026-05-13T21:27:22+00:00

Using Restlet I have created a router for my Java application. From using curl,

  • 0

Using Restlet I have created a router for my Java application.

From using curl, I know that each of the different GET, POST & DELETE requests work for each of the URIs and return the correct JSON response.

I’m wanting to set-up JUnit tests for each of the URI’s to make the testing process easier. However, I’m not to sure the best way to make the request to each of the URIs in order to get the JSON response which I can then compare to make sure the results are as expected. Any thoughts on how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:27:22+00:00Added an answer on May 13, 2026 at 9:27 pm

    You could just use a Restlet Client to make requests, then check each response and its representation.

    For example:

    Client client = new Client(Protocol.HTTP);
    Request request = new Request(Method.GET, resourceRef);
    Response response = client.handle(request);
    
    assert response.getStatus().getCode() == 200;
    assert response.isEntityAvailable();
    assert response.getEntity().getMediaType().equals(MediaType.TEXT_HTML);
    
    // Representation.getText() empties the InputStream, so we need to store the text in a variable
    String text = response.getEntity().getText();
    assert text.contains("search string");
    assert text.contains("another search string");
    

    I’m actually not that familiar with JUnit, assert, or unit testing in general, so I apologize if there’s something off with my example. Hopefully it still illustrates a possible approach to testing.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using RESTlet and I have created a resource. I handle POST by
I have deployed our Restlet services to a Jetty Java Application server using the
Using restlet, I want to make a post to android's c2dm service. I have
We're using Restlet 2.0.8 and have an Application instance overwriting org.restlet.Application#createInboundRoot(). In there, we
I'm using restlet 2.0.11 to provide data for a Dojo-based web application via a
I am using restlet 1.0, and i am trying to post a new entry
I am needing to get the application root within a Restlet resource class (it
I have figured out that to integrate calls between Apache HTTP server and Restlet,
Where can I embed startup initialization code in a Restlet web application, without using
I am using restlet server has a RESTful provider for my mobile application. Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.