Top "Unit-testing" questions

Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.

How do I assert an Iterable contains elements with a certain property?

Assume I want to unit test a method with this signature: List<MyItem> getMyItems(); Assume MyItem is a …

java unit-testing junit4 hamcrest
annotation to make a private method public only for test classes

Who has a solution for that common need. I have a class in my application. some methods are public, as …

java unit-testing junit annotations
Angular 2 Unit Tests: Cannot find name 'describe'

I'm following this tutorial from angular.io As they said, I've created hero.spec.ts file to create unit tests: …

unit-testing angular typescript jasmine
Can a unit test project load the target application's app.config file?

I am unit testing a .NET application (.exe) that uses an app.config file to load configuration properties. The unit …

c# .net unit-testing app-config
Best way to test exceptions with Assert to ensure they will be thrown

Do you think that this is a good way for testing exceptions? Any suggestions? Exception exception = null; try{ //I m …

c# .net unit-testing
Injecting @Autowired private field during testing

I have a component setup that is essentially a launcher for an application. It is configured like so: @Component public …

java spring unit-testing junit autowired
Unit testing void methods?

What is the best way to unit test a method that doesn't return anything? Specifically in c#. What I am …

c# unit-testing void
Using Spring MVC Test to unit test multipart POST request

I have the following request handler for saving autos. I have verified that this works when I use e.g. …

spring unit-testing spring-mvc
Best practices to test protected methods with PHPUnit

I found the discussion on Do you test private method informative. I have decided, that in some classes, I want …

php unit-testing phpunit
How can I write output from a unit test?

Any call in my unit tests to either Debug.Write(line) or Console.Write(Line) simply gets skipped over while …

c# visual-studio unit-testing debugging mstest