Linked Questions

27
votes
7answers
17k views

Why did Java make package access default?

I'm asking this question because I believe they did it for a very good reason and that most people do not use it properly, well from my experience in industry so far anyway. But if my theory is true ...
17
votes
5answers
6k views

When to use interfaces (unit testing, IoC?)

I suspect I've made a schoolboy error here, and am looking for clarification. A lot of the classes in my solution (C#) - dare I say the majority - I've ended up writing a corresponding interface for. ...
3
votes
4answers
158 views

What is the best practice for a regression test that wants to know about encapsulated information?

Suppose you have two classes: Alpha, and Bravo. Alpha constructs a new Bravo class during its own constructor and exposes no public visibility to it. Bravo has a String named charlie (and a method to ...
21
votes
3answers
8k views

Designing unit tests for a stateful system

Background Test Driven Development was popularized after I already finished school and in the industry. I am trying to learn it, but some major things still escape me. TDD proponents say lots of ...
10
votes
3answers
2k views

Unit testing methods that call suppliers webservices

I have a class with one public method Send() and a few private methods. It calls a couple of webservices and processes the reponse. The processing is done in private methods. I want to unit test the ...
0
votes
3answers
478 views

What concept am I missing with private methods and testing? [duplicate]

I've read a lot o blogs arguing about private methods and testing. Some people say you should not test private methods, they say you should make them public or put those methods in a new class. But ...
4
votes
2answers
163 views

continuous integration impact on ticket sizing

I've been doing research on CI (continuous integration) and I can't find any info on the changes CI would introduce to ticket sizing. CI states developers should merge to the mainline every day (or ...
3
votes
2answers
418 views

Test Internals with TDD?

I'm new to TDD, and relatively new to software development in general (e.g. < 4 years experience), but I am trying to learn. I have been toying with TDD but ran into what I know realize is a ...
2
votes
2answers
1k views

Why is white box testing discouraged in OOP?

It seems the general consensus for unit testing classes is to test your object through its public interface only. So if you wanted to test the removeElement method on a LinkedList class you'd need to ...
0
votes
2answers
3k views

How do I go about unit testing a private method that gets called in a loop like this one? [duplicate]

How do I go about unit testing a private method that gets called in a loop like this one: // Calls MethodToUnitTest in a loop public static string Generate(params int[] values) { ...
9
votes
1answer
7k views

Testing private methods as protected

I was reading this answer about testing private methods and it mentioned several possibilities: extract methods as public to another class make them public separate the env of test and production ...
2
votes
1answer
3k views

How to structure a chain of method calls [duplicate]

To keep it simpler for any client of my class, I have put a sequence of private method calls within one public method. The client then calls this method and all the methods within run to complete the ...
1
vote
1answer
3k views

Testing a private method in Java [duplicate]

I am new writing good test cases, so please bear with me. Writing a test case for private methods public Stock getStock(String stockTicker) { Stock company = new Stock(); ...
-1
votes
1answer
59 views

Unit test Service Class [duplicate]

In my project, I have two type of Service Class : The simple one, they are interface that use the DAOs The complicated one, are Rest Api Service The Rest Service will make call to an API, and map ...
3
votes
0answers
87 views

How to properly test many methods when main logic is in private method [duplicate]

This is a little bit of follow up question to How to test private methods. I totally agree (and experienced what happens when you try) that we should not test private methods. Sometimes though it ...

15 30 50 per page