Most voted "junit" questions
Popular unit testing framework for Java and Scala. The latest version, Junit 5, supports the new Java 8 added Features, for example lambda Expressions. Consider using in conjunction with the Java or Scala tag to indicate your use case.
Learn more…116 questions
Sort by count of
-
0
votes1
answer22
viewsHow to include unit test artifacts in a simple Java application?
This is my project in my repository; PROJECT Note the pom.xml file <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"…
-
0
votes1
answer646
viewsDisable infobar from Chrome when running automated testing
I tried to implement a method that will maximize the Chrome window and deactivate infobar when starting tests, but neither of the two actions will happen when running. Actions are in the method…
-
0
votes1
answer324
viewsjava.lang.Assertionerror: Expected: not null but: was null - Junit test
The variable result is returning NULL although the Object is filled. This is my test; @RunWith(MockitoJUnitRunner.class) public class IndicioDAOTest { @Mock private IndicioDAO indicioDAO; @Test…
-
0
votes0
answers66
viewsNullpointerexception in a Junit query!
Observe the code below; @Sql(statements = { "INSERT INTO GrupoTipoIndicio (Codigo,Nome) VALUES (1,'segundo grupo')", "INSERT INTO GrupoTipoIndicio (Codigo,Nome) VALUES (2,'primeiro grupo')", "INSERT…
-
0
votes0
answers106
viewsProblems with Junit
I’m trying to run some tests on a small application for JAX-RS studies. The following error is shown when I try to run a test case to simulate a GET org.junit.vintage.engine.support.UniqueIdReader…
-
0
votes1
answer259
viewsHow to test Controller with Junit?
I’m testing the URL like this package br.com.aluguel.de.carros.unidade.usuario; import br.com.aluguel.de.carros.endereco.Endereco; import br.com.aluguel.de.carros.usuario.Usuario; import…
-
0
votes1
answer118
viewsInstantiate Dependency Injection Class using Kotlin in Unit Tests
I’m trying to find a solution for how I can instantiate a class that uses dependency injection into unit testing using Kotlin and Junit. I have a class that uses addiction injection: class…
-
0
votes0
answers220
viewsError when running unit tests of Repository
Previously the test worked and after a while stopped working. The structure in the database was not changed. get the message: Failed to load ApplicationContext java.lang.IllegalStateException:…
-
0
votes0
answers11
viewsAssertionerror error in Selenium
I’m trying to perform a message list comparison test using Selenium, notice how I’m capturing the list. public List<String> localizadorListaMensagens(By by) { List<WebElement> mensagens…
-
-1
votes1
answer251
viewsMockito returning null Spring Boot + Junit + org.mockito.Bddmockito
Everything all right, guys? At the time I make a mock my error application and returns null of the mock, I have tried several ways to resolve, but it does not send anything different, could help me?…
-
-1
votes0
answers8
viewsHow to do Junit in this method?
I’m learning Junit and I’m trying to test the toString method, but I can’t do it. I would like the help to understand where and how I should begin. Follows code below public String toString(){…
-
-1
votes1
answer415
viewsUnit test of an SQL query in Junit
I need some help to do the unit test on Junit. How to do the @Test method below: public static StringBuilder findSQLPA() { StringBuilder sql = new StringBuilder(); sql.append(" select…
-
-1
votes1
answer25
viewsValue returns only true in JUNIT4
I’m trying to do a shooting sport procedure, at the time I will test, every time changing "posso_shoot.setIdentificar_target(1);", when the value and 1 returns true, that’s what I want, but when I…
-
-2
votes1
answer658
viewsHow to mock a private function in Junit
I have a main class Usuario extending (extends) an abstract class called Sessao, and uses a function of Sessao calling for obterDados() that takes session data and returns to an object SessaoTO. I…
-
-3
votes1
answer745
viewsI’m not getting a unit test
I have a problem to do a test method in this JAVA program. The method I devised was to verify that the wolf is dead. @Test public void verificaSeOLoboMorreAposCompletarAIdade(){ campo = new…
-
-4
votes1
answer603
viewsHow to apply unit test when the main class is an interface?
I have this method in my Beginning class @Override public void question() { String question = String.format(TEXT_OF_A_QUESTION, this.namePlate); int answer = JOptionPane.showConfirmDialog(null,…