Linked Questions

4 votes
3 answers
299 views

I am trying to learn TDD by creating a copy of an existing MVC app I have but I am creating a copy of it from scratch using TDD. In my existing app I have an Application_AuthenticateRequest method as ...
Dave Amour's user avatar
3261 votes
59 answers
1.3m views

How do I use JUnit to test a class that has internal private methods, fields or nested classes? It seems bad to change the access modifier for a method just to be able to run a test.
425 votes
31 answers
173k views

I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do ...
Patrick Desjardins's user avatar
41 votes
5 answers
29k views

Suppose I have interface and implementation class that implements it and I want to write unit-test for this. What should I test interface or Impl? Here is an example: public interface ...
alexsmail's user avatar
  • 5,823
5 votes
1 answer
3k views

We are developing a new API at work. My colleague and I are having different opinion regarding whether internal classes should be unit tested or not. Points given by my colleague for not unit testing ...
Samarsh's user avatar
  • 565
8 votes
3 answers
685 views

This is in part a followup to this question. I'm not sure the best way to ask this, so I'll try a short story to set the scene: Once upon a time, there was a class ‘A’, which had a unit test class ‘...
forsvarir's user avatar
  • 10.9k
1 vote
3 answers
467 views

The consensus seems to be not to test private methods when doing TDD. Should Private/Protected methods be under unit test? I keep hitting this same scenario. I have a private method (as an example ...
atreeon's user avatar
  • 24.4k
2 votes
2 answers
1k views

I have a class like this: Notice it does not have a default constructor either and inherits from some other class public class IdentifierManager : IdentifierManagerBase { public IdentifierManager(...
LonelySemiColon's user avatar
2 votes
1 answer
977 views

I have following controller that has only private functions. I am struggling to test this controller. Shall I test if it is doing $emit, since the ImageService has been tested? How do I test $emit in ...
Tsolmon's user avatar
  • 71
0 votes
2 answers
844 views

I'm new to unit testing and I'd like to know how is this, I guess typical, problem usually solved: I have protected method that I'd like to test. I've overriden the tested class with the test class, ...
dragan.stepanovic's user avatar
3 votes
1 answer
924 views

What would be the best practice for unit testing a method that only calls 2 other methods and no logic? internal ICollection<ObjA> FunctionA() { IEnumerable<ObjB> b = _factory....
Leo Reyes's user avatar
  • 101
0 votes
1 answer
300 views

In my class, to test, I have a private boolean instance variable and a method to access it: MyClass() { private volatile bool b; public MyMethod() { b = false; } } After ...
Gobliins's user avatar
  • 4,096
1 vote
1 answer
120 views

I've been working on a simple project on Adobe Extend Script Toolkit and is having trouble implementing tests on private members. I have come up with a solution which is to expose the privates inside ...
Anthony's user avatar
  • 599
0 votes
1 answer
140 views

I have the following scenario: public class Child : Parent { private int _eventTypeId; public override Dictionary<string, dynamic> Execute(IDynamicDatabaseConnection dbConn, IDbTransaction ...
tRuEsAtM's user avatar
  • 3,751