Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Stub pattern #381

Open
jdoetricksy opened this issue Feb 15, 2016 · 3 comments
Open

Service Stub pattern #381

jdoetricksy opened this issue Feb 15, 2016 · 3 comments

Comments

@jdoetricksy
Copy link

jdoetricksy commented Feb 15, 2016

Description

The Service Stub design pattern is used to create a simplified version of a service that mimics the behavior of a real service in a controlled manner. This is especially useful during development and testing phases when the actual service might be unavailable or its usage might be costly or impractical. The stub can return predefined responses and simulate various scenarios to ensure the application behaves as expected.

Main Elements of the Pattern:

  • Stub Creation: Develop a stub that implements the same interface as the real service.
  • Predefined Responses: Configure the stub to return predefined responses based on input parameters.
  • Behavior Simulation: Simulate various behaviors such as success, failure, and exceptions.
  • Seamless Replacement: Ensure the stub can be seamlessly replaced with the real service with minimal changes to the application code.

References

  1. Service Stub Pattern - Martin Fowler
  2. Mock and Stub in Unit Testing
  3. Java Design Patterns Wiki - Contribution Guidelines

Acceptance Criteria

  1. Create a new package service-stub under the patterns directory.
  2. Implement the service stub following the principles of the pattern, including predefined responses and behavior simulation.
  3. Provide comprehensive unit tests to validate the stub's behavior in different scenarios.
  4. Update the README with an explanation of the Service Stub pattern, including example usage and code snippets.
jdoetricksy pushed a commit to jdoetricksy/java-design-patterns that referenced this issue Mar 11, 2016
Service-stub design pattern
@jdoetricksy jdoetricksy mentioned this issue Mar 11, 2016
npathai added a commit that referenced this issue Aug 7, 2016
@iluwatar
Copy link
Owner

This issue is free for taking once again.

@himanshucodes
Copy link

I'd like to work on this.

Copy link

stale bot commented Dec 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale issues and pull requests that have not had recent interaction label Dec 7, 2023
@stale stale bot removed the status: stale issues and pull requests that have not had recent interaction label Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment