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

The Archive Base Latest Questions

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

In TDD how should you continue when you know what your final outcome should

  • 0

In TDD how should you continue when you know what your final outcome should be, but not the processing steps you need to get there?

For example your class is being passed an object whose API is completely new to you, You know the class has the information you need but you don’t know how to retrieve it yet: How would you go about testing this?

Do you just focus on the desired result ignoring the steps?

Edit 1

package com.wesley_acheson.codeReview.annotations;

import com.sun.mirror.apt.AnnotationProcessor;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;

public class AnnotationPresenceWarner implements AnnotationProcessor {

    private final AnnotationProcessorEnvironment environment;

    public AnnotationPresenceWarner(AnnotationProcessorEnvironment env) {
        environment = env;
    }

    public void process() {
        //This is what I'm testing
    }

}

I’m trying to test this incomplete class. I want to test I have the right interactions with AnnotationProcessorEnvironment within the process method. However I’m unsure from the API docs what the right interaction is.

This will produce a file that contains details on the occurrence of each annotation within a source tree.

The actual file writing will probably be delegated to another class however. So this class’ responsiblity is to create a representation of the annotation occurrences and pass that to whatever classes need to move it.

In non TDD I’d probably invoke a few methods set a breakpoint and see what they return.

Anyway I’m not looking for a solution to this specific example more sometimes you don’t know how to get from A to B and you’d like your code to be test driven.

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

    I’m basing my answer on this video:
    http://misko.hevery.com/2008/11/11/clean-code-talks-dependency-injection/

    If you have a model/business logic class that’s supposed to get some data from a service then I’d go about this way:

    1. Have your model class take the data that it needs in the constructor, rather than the service itself. You could then mock the data and unit test your class.

    2. Create a wrapper for the service, you can then unit test then wrapper.

    3. Perform a fuller test where you actually pass the data from the wrapper to the model class.

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

Sidebar

Related Questions

I'm somewhat informed with TDD and BDD with Ruby/Rails, but I will eventually need
I know how to do TDD in other languages, but I'm new to both
In my question As a mockist TDD practitioner, should I mock other methods in
I see lots of TDD practitioners following this cycle: 1) Write your test as
I'm learning TDD (in Javascript), and I wanted to know, what is the right
I'm trying to do TDD, I'm not clear on how to do it for
I am trying to practice TDD. My understanding is that TDD should go like
I am trying to embrace TDD and started learning about mocking. I need some
I am new to TDD and want to know which kind oft test i
A number of developers are designing their applications using Test Driven Development (TDD) but

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.