Skip to content
Advertisement

Tag: junit4

@Before/@BeforeEach inheritance behaviour change JUnit4 / JUnit5

When migrating from JUnit4 to JUnit5 I found a change in the behaviour of JUnit4 and JUnit5 and wanted to check if the change was a bug in JUnit4 or in JUnit5 and how to do it correctly. Lets assume the following structure: One base class Another class that inherits from this base class And an actual test class If

NullPointerException on validating email

I am writing a unit test to check the email validation logic. The logic is throwing null pointer exception when you run the test. But it works fine with emulator. Can someone help me solving this? Below is my unit test. The error I am getting is, Answer android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches() exists since API level 8, May be your emulator is prior

junit test for stateless ejb + jpa

I would like to write a junit test for my stateless ejb + jpa demo code. I think it is actually not a junit test, it is an integration test. I have a stateless ejb with an injected EntityManager and PostgreSQL database server is used. I use CDI (Spring is not used in my project) and EclipseLink with a persistent.xml

maven error: package org.junit does not exist

I’m trying to create the javadoc with maven and it fails. It also fails when doing the verify. I get the following error: In my pom.xml file I have the following lines: and my local repository contains the junit jar file: The code is fine because in my laptop, which I have no access now, I van run: with no

Loop through array, each element a JUnit test

I have a JUnit 4 test that loops through an array of test data: Because it’s all in one test method, the whole test stops as soon as one element in the array fails. Is there a way around that, without making a method for each test item? Maybe something with reflection? Answer Use JUnit 4’s parameterized tests. They are

Advertisement