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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:40:35+00:00 2026-05-12T17:40:35+00:00

I recently discussed with a colleague about mocking. He said that mocking classes is

  • 0

I recently discussed with a colleague about mocking. He said that mocking classes is very bad and should not be done, only in few cases.

He says that only interfaces should be mocked, otherwise it’s an architecture fault.

I wonder why this statement (I fully trust him) is so correct? I don’t know it and would like to be convinced.

Did I miss the point of mocking (yes, I read Martin Fowler’s article)

  • 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-12T17:40:35+00:00Added an answer on May 12, 2026 at 5:40 pm

    Mocking is used for protocol testing – it tests how you’ll use an API, and how you’ll react when the API reacts accordingly.

    Ideally (in many cases at least), that API should be specified as an interface rather than a class – an interface defines a protocol, a class defines at least part of an implementation.

    On a practical note, mocking frameworks tend to have limitations around mocking classes.

    In my experience, mocking is somewhat overused – often you’re not really interested in the exact interaction, you really want a stub… but mocking framework can be used to create stubs, and you fall into the trap of creating brittle tests by mocking instead of stubbing. It’s a hard balance to get right though.

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

Sidebar

Related Questions

Recently we discussed a defect mentioned here and one of the parties said something
Recently I found about this tool easy_install that help me to easy install additional
Recently, I saw a colleague of mine instantiate his classes in a constructor, so
Recently a friend and I were talking about securing stored procedure code in a
I was recently asked by a Team Leader (not mine) if I would be
A textbook I recently read discussed row major & column major arrays. The book
Recently i've switched to PHP 5.3+ and after that migration i learned that the
recently I've installed the FireGestures plugin for Firefox, which I find very useful. You
Recently I've started hearing about POJOs (Plain Old Java Objects). I googled it, but
Recently a client was concerned that their SWF was insecure because the XML path

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.