Skip to main content

Questions tagged [junit]

1 vote
3 answers
650 views

So I have two identical classes, say ClassA and ClassB. In both classes, they operate on the same kind of data classes, and the method bodies are exactly the same. The only difference is that the ...
kroger9's user avatar
  • 25
6 votes
1 answer
3k views

I'm writing integration tests for an already existing product. I'm using the Spring Integration Testing suite for this purpose, which allows testing a real DB connection by creating a transaction and ...
Christian Vincenzo Traina's user avatar
-1 votes
2 answers
1k views

I have a function to be tested fn doNothing(Student student) { //do some other operations here. but student is unmodified return student; } And my unit test is var student = new Student("...
Santhosh Thamaraiselvan's user avatar
-2 votes
1 answer
2k views

I enjoyed the process of writing an integration test for a system that relies on http, by mocking such end-points with Wiremock, and I feel upskilled, having wrestled with Matchers. Now, Wiremock as a ...
HellishHeat's user avatar
5 votes
4 answers
6k views

I am curious if the following example of testing a class with protected methods is fine. For example, say you have the following class Foo that has method a() of return type Bar: class Foo { ...
oneturkmen's user avatar
2 votes
1 answer
364 views

I'm new to JUnit/Mockito and to unit testing in general. I'm asking this question in order to get feedback and learn best practices/patterns/strategies. I wrote a class but when came time to unit test ...
totsubo's user avatar
  • 129
-3 votes
1 answer
117 views

Simply, given that Selenium is a testing tool, it seems redundant to combine Junit with Selenium tests. Does one write the Selenium test and then a separate Junit test of the Selenuium test or should ...
releseabe's user avatar
  • 539
0 votes
1 answer
100 views

From the perspective of unit testing, the code under test should obviously not be accessing outside resources so the third party methods need to be mocked. However, it seems like this is poor practice ...
JobHunter69's user avatar
3 votes
3 answers
402 views

By "more object-oriented", I mean, it appears to me testing frameworks like TestNG and JUnit could encourage testers to write implementations of Test and TestSuite interfaces. The current approach ...
Benjamin Berman's user avatar
0 votes
1 answer
806 views

Reference: http://junit.sourceforge.net/junit3.8.1/javadoc/junit/framework/TestCase.html#setUp() setUp should have ideally be named as setup I've explored if any duplicate method setup is used in ...
kai's user avatar
  • 245
-1 votes
1 answer
418 views

Currently I have an entity called Product with the respective ProductRepository and ProductService. For ProductService, I have tests for: Read (Covering Create too) Update Delete Besides achieving ...
0xFED5550's user avatar
  • 107
10 votes
3 answers
592 views

We know that writing JUnit tests demonstrates one particular path through you code. One of my associates commented: Manually writing unit tests is Proof By Example. He was coming from the ...
hawkeye's user avatar
  • 4,849
15 votes
5 answers
71k views

In order to fix a bug in an application, I modified a method named postLogin by adding a call to an existing method named getShoppingCart. Code protected void postLogin() { getShoppingCart(); } ...
A_B's user avatar
  • 409
4 votes
2 answers
3k views

I have recently tried to to implement unit tests on a Java Web Application my project is built on MVC design architecture and uses Spring & JPA Hibernate and JSF here is a package tree -src -...
Youans's user avatar
  • 501
1 vote
2 answers
307 views

A Tech Lead in my team said: We're going to use sonar on our (500KLoc) codebase so that everytime you do a commit, it will check the classes you've touched against the coverage goals. If you don't ...
hawkeye's user avatar
  • 4,849

15 30 50 per page