Skip to main content

All Questions

Tagged with
2 votes
2 answers
406 views

Should mocks used in unit tests represent entireties or subsets?

I was working on a unit test that has a mock object looking something like: public class TestMock { static { Doodad a = new Doodad(0); Doodad b = new Doodad(1); Doodad c = ...
pstatix's user avatar
  • 1,047
0 votes
1 answer
2k views

Java: Splitting a large unit test class

The project (Java/Spring) I currently work on has a rather large unit-test class for one of its services : more than 1000 lines, several Nested class (one per big functionality), some tests without a ...
Baerrow's user avatar
  • 125
-1 votes
3 answers
1k views

Should methods with business logic be made private? [duplicate]

So I am writing a project using Spring Boot. All of my logic resides in @Service classes. I have separated each service class based on entity. For example - If I have two independent entities A and B, ...
rsp's user avatar
  • 143
0 votes
2 answers
387 views

Design Java Testing class for hierarchical objects

Consider the following POJO structure in my main code. I want to create some testing framework for this kind of hierarchical classes, where the calling test method can specify if they want to modify a ...
Novice User's user avatar
1 vote
2 answers
2k views

What are the drawbacks of modeling (unit) test fixtures in JSON instead of using ObjectFactories?

When writing java tests for an application, be they unit tests or testing a broader scope, the java community tends to model fixtures in terms of object factories that produce fixtures of a defined ...
Kiriakos Krastillis's user avatar
3 votes
2 answers
390 views

Better To Call In Dive Into Submethods Or Pass Around a result

I have a service that does fairly complicated business logic when it receives a request. I have most the functionality isolated into private methods which dive a couple levels down from the method ...
ford prefect's user avatar
5 votes
5 answers
11k views

Is it feasible and useful to auto-generate some code of unit tests?

Earlier today I have come up with an idea, based upon a particular real use case, which I would want to have checked for feasability and usefulness. This question will feature a fair chunk of Java ...
skiwi's user avatar
  • 1,138
5 votes
3 answers
2k views

Inheritance vs containment while extending a large legacy project

I have got a legacy Java project with a lot of code. The code uses MVC pattern and is well structured and well written. It also has a lot of unit tests and it is still actively maintained (bug fixing, ...
Flot2011's user avatar
  • 2,192
1 vote
1 answer
5k views

Is it worth writing a unit test for a DTO with the most basic getter/setters? [duplicate]

The advantage is it protects your DTO against future "enhancements" ?
NimChimpsky's user avatar
  • 4,670