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

The Archive Base Latest Questions

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

Assume you have a method Tree supersizeMe(Tree input) . Both input and the return

  • 0

Assume you have a method Tree supersizeMe(Tree input) . Both input and the return value are recursive data structures, and the method returns a structure with a size factor of about 500. Hence if input is the smallest element possible, the return value of the function contains about 500 elements.

This is the short description of a situation I currently have, and I am supposed to write a unit test.
Of course, having a minimal output size of ~500 elements, I can’t really base my tests on assert-statements. So here is my question:

What is a good idea to test such a method?

PS: I can verify the output manually by sending it through an external program; Such functionality is included in my API, but using those classes conflicts with the idea of a unit-test, doesn’t it?

Edit: The API is developed in java, and I use jUnit4 for tests.

  • 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:57:38+00:00Added an answer on May 26, 2026 at 6:57 am

    but using those classes conflicts with the idea of a unit-test, doesn’t it?

    The idea of a unit test is that it tests single units of code in isolation. I don’t see how using complex third-party code to verify correctness would run against that.

    The real question is whether the transformation is in itself a simple enough operation that a failing test would give you a good idea where the problem is. If not, you may want to break it down into smaller operations that can be tested independently.

    There may be TDD purists that claim any test that is not immediately and completely understandable and tells you exactly in which line of code the problem is is not a true unit test, and that using a third-party API is not acceptable, but they can go suck on their dogma while you enjoy your working, tested code.

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

Sidebar

Related Questions

Let's assume we have a method handling operations in a tree hierarchical data structure
Assume I have some C++ method which returns back a pointer to an object.
Assume we have a method like this: public IEnumerable<T> FirstMethod() { var entities =
Let's assume we have the following method in the business layer. What's the best
Assume I have method void SomeMethod(Action callback) This method does some work in background
Assume I have a method/function with the following signature: foo($bar = 0) Inside foo
Assume I have a method with the signature: + (NSString *) myFormattedString:(NSString *)format, ...;
I have a menu system that uses a drag and drop tree structure to
Assume that you have an idCollection IList<long> and you have a method to get
I have a method that parses an xml document. I assume this method should

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.