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

  • Home
  • SEARCH
  • 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 6700949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:52:30+00:00 2026-05-26T06:52:30+00:00

I have a method which doesn’t return a value. It instead accepts a list

  • 0

I have a method which doesn’t return a value. It instead accepts a list and modifies the members of this list. Obviously the list itself is mutable, as are its members.

EG: I want to mock this:

    void modifyRequests(List<MutableObject> requests);
  • 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-26T06:52:31+00:00Added an answer on May 26, 2026 at 6:52 am

    Well, various mocking frameworks do provide ways of doing this (executing custom actions which use the parameters when a method is invoked) – but I would strongly consider not using mocking. Unless you really want to validate the protocol between your class-under-test and its collaborators, you should consider writing a fake instead of a mock. Then you can make the fake behave however you like – and typically (IME) you end up with simpler test code.

    It’s not always appropriate, and mocking certainly has its place – but over time I’ve found that a well-written fake can be worth its weight in gold, particularly if it’s a dependency used by many classes.

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

Sidebar

Related Questions

I have an insertOrUpdate method which inserts an Entity when it doesn't exist or
I have this method, that can return three different response. At first, it was
I have a method which is supposed to return a PatientDetails object when I
I have written method which should return string with data from select query, but
I have written certain code which doesn't exactly have a main method. But I
I have a user control which does some validation in the ValidateChildren method which
Does a method which I check for with respondsToSelector have to actually exist? What
Does anyone have any advice on which method is better when caching data in
I have a method which takes params object[] such as: void Foo(params object[] items)
I have a method which should be executed in an exclusive fashion. Basically, it's

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.