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 6811323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:18:48+00:00 2026-05-26T20:18:48+00:00

A Controller consist of two main parts: Mapped URL Code inside method When writing

  • 0

A Controller consist of two main parts:

  • Mapped URL
  • Code inside method

When writing a test case there is two parts to test.

  • Testing URL’s and mapping
  • Testing the code inside the function after mapping

Using classical test cases, using mock HttpServletResponse etc., using RESTtemplates (instead of using curl) are considerable things to use.

Question is that: Which one to use, how to use them, how to combine them and does it require logically separate that two test parts?

What kind of pattern to use to test a RESTful Service.

  • 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-26T20:18:49+00:00Added an answer on May 26, 2026 at 8:18 pm

    First of all:

    • Good tests find bugs. (Tests must not find a bug now, they are also good tests when they find a bug some where in the furure while anybody is changing anything.)
    • Bad test did not find bugs. (If a single test never failed, the whole time the project was developed or maintaind, then the test was useless.)
    • And tests never prove that there is no bug!

    So when I write tests I try to write them as easy as possible but also try to test every thing that I belive that I can go wrong.

    So for example your Restfull Services:

    Of course there can be many bugs in the logic, so one need to write a lot of tests for them. But this tests can directly invoke the method and so that its relativ easy to write the tests. Much more easyer than invoking the methods throug the some HTTP invokation.

    But of course there can be an mistake in the HTTP invation so that must be tested to. But because I have already tested the “code” with my normal Unit tests. I only need not so many of that hard to write test. And this Test focus more on the bugs that can be done by wrong mapping or wrong serilization.

    So at the end: Use all kind of tests that you can write (Unit Test, Mocked Stuff, HttpUnit test, Selenium,…). But first to think about the problem you want to test. And the choose the kind of test where you can write and maintain that test case easy.


    Btw @see RestFuse – JUnit extension

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

Sidebar

Related Questions

I have a navigation controller based app. My views consist of two tableviews laid
I want my controller to return the right HTTP response code when the user
I came across a controller in an older set of code (Rails 1.2.3) that
Given a controller method like: def show @model = Model.find(params[:id]) respond_to do |format| format.html
I have a controller with an action method as follows: public class InventoryController :
My homepage (or welcome page) will consist of data from two models (lets call
I have built mini widgets that consist of a model, a controller a couple
I have a user controller which consists of a method named listfolders(). class UserController
In the past, when writing my code, I always assumed that the model should
My UI will consist of a tab bar controller as the root controller with

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.