NetBeans Junit5 Tests-Output ignore DisplayName Nested-Format - netbeans

I do not get the names from the annoations "#DisplayName" as a test result in NetBeans. Only the names of the test functions are shown. The grouped display of the nested tests is also ignored.
Source code
#DisplayName("test facade")
public class TestFacadeTest {
#BeforeAll
public static void setUpClass() {
}
#AfterAll
public static void tearDownClass() {
}
#BeforeEach
public void setUp() {
}
#AfterEach
public void tearDown() {
}
#Test
#DisplayName("senseless test")
public void test(){
Assertions.assertTrue(true);
}
#Nested
#DisplayName("tests - compareStringNullSave")
class CompateStringNullSaveTestGroup {
#BeforeEach
public void setUp() {
}
#Test
#DisplayName("both identical")
public void Test1(){
String str1 = "Test123";
String str2 = "Test123";
Assertions.assertTrue(TestFacade.compareStringNullSave(str1, str2));
Assertions.assertTrue(TestFacade.compareStringNullSave(str2, str1));
}
#Test
#DisplayName("Identical text but different uppercase and lowercase letters")
public void Test2(){
String str1 = "Test123";
String str2 = "test123";
Assertions.assertFalse(TestFacade.compareStringNullSave(str1, str2));
Assertions.assertFalse(TestFacade.compareStringNullSave(str2, str1));
}
}
}
Extract from the pom.xml
<dependencies>
[...]
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
[...]
</dependencies>
<build>
<plugins>
[...]
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<properties>
<configurationParameters>
junit.jupiter.conditions.deactivate = *
junit.jupiter.extensions.autodetection.enabled = true
junit.jupiter.testinstance.lifecycle.default = per_class
</configurationParameters>
</properties>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
What do I have to set so that the test display in NetBeans shows the DisplayNames and uses the nested grouping?
NetBeans version: 12.0
Java version: 11 (OpenJDK)

Maven added support for the #Display annotation in the 3.0.0.0-M4 version of the surefire plugin. Also, you need to configure the parameters of statelessTestsetReporter and statelessTestsetInfoReporter extensions to allow for NetBeans to match display names correctly.
So currently (01.2021), you can use 3.0.0.0-M4 or newer versions of the surefire plugin, and the version of JUnit should be more than 5.5.2. Something like that should work:
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
<version>3.0</version>
<usePhrasedFileName>true</usePhrasedFileName>
<usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
<usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
<usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
</statelessTestsetReporter>
<statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoReporter">
<usePhrasedClassNameInRunning>true</usePhrasedClassNameInRunning>
</statelessTestsetInfoReporter>
<properties>
<configurationParameters>
junit.jupiter.conditions.deactivate = *
junit.jupiter.extensions.autodetection.enabled = true
junit.jupiter.testinstance.lifecycle.default = per_class
</configurationParameters>
</properties>
</configuration>
</plugin>
</plugins>
Here how it looks in my case:
#DisplayName("Display Name of class")
public class testClassSimple {
#Test
#DisplayName("Display name of method 1")
public void testMethod1() {
}
#Test
#DisplayName("Display name of method 2")
public void testMethod2() {
}
}
As for nested grouping and the #Nested annotation, currently, NetBeans doesn't support nested grouping of test results in the test result window. Probably it's better to use different classes for such tests instead of nested classes.

Related

It says status":500,"error":"Internal Server Error on soapui when I request for a response

This endpoint class
correlate the methods from request and response classes from the target as I put the request and response classes in target directory.
package com.security.test;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import security.test.GetTestRequest;
import security.test.GetTestResponse;
#Endpoint
public class TestEndpoint {
private final String NAMESPACE_URI="http://security/test";
#PayloadRoot(namespace = NAMESPACE_URI, localPart = "getTestRequest")
#ResponsePayload
public GetTestResponse securityResponse(#RequestPayload GetTestRequest request){
GetTestResponse response = new GetTestResponse();
String given=request.getGivenString();
int myAge=given.length();
response.setLength(myAge);
System.out.println(response);
return response;
}
}
All the dependencies from pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.security</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>test</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>18</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.wss</groupId>
<artifactId>xws-security</artifactId>
<version>3.0</version>
<exclusions>
<exclusion>
<groupId>javax.xml.crypto</groupId>
<artifactId>xmldsig</artifactId>
</exclusion>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>${project.basedir}/src/main/resources/test.xsd</source>
</sources>
</configuration>
</plugin>
</plugins>
</build>
</project>
using xwsInterceptor it intercept the request and looks for authentication using simple passwordvalidationCallHandler
This webSConfig class extends WsConfigurerAdapter
{
#Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
#Bean(name = "test")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema testSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("TestPort");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace("http://security/test");
wsdl11Definition.setSchema(testSchema);
return wsdl11Definition;
}
#Bean
public XsdSchema testSchema() {
return new SimpleXsdSchema(new ClassPathResource("test.xsd"));
}
#Bean
public XwsSecurityInterceptor securityInterceptor() {
XwsSecurityInterceptor securityInterceptor = new XwsSecurityInterceptor();
securityInterceptor.setCallbackHandler(callbackHandler());
securityInterceptor.setPolicyConfiguration(new ClassPathResource("securityPolicy.xml"));
return securityInterceptor;
}
#Bean
public CallbackHandler callbackHandler() {
SimplePasswordValidationCallbackHandler callbackHandler = new SimplePasswordValidationCallbackHandler();
callbackHandler.setUsersMap(Collections.singletonMap("admin", "pwd123"));
return callbackHandler;
}
#Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
interceptors.add(securityInterceptor());
}
}
however, I am not getting the right response,It even does not response about the security issue it responses status":500,"error":"Internal Server Error on soapUi while I run the request. and the intellij response as
java.lang.IllegalAccessError: class com.sun.xml.wss.impl.SecurableSoapMessage (in unnamed module #0x60285225) cannot access class com.sun.org.apache.xml.internal.security.Init (in module java.xml.crypto) because module java.xml.crypto does not export com.sun.org.apache.xml.internal.security to unnamed module #0x60285225

Not able to generate querydsl Q classes with Azure CosmosDB because #Entity annotation is not present

I am just trying to do a POC using spring boot data jpa along with Azure CosmosDB and query dsl. My plugin in pom.xml looks like this where I am using com.querydsl.apt.jpa.JPAAnnotationProcessor Annotation processor which is supposed to scan files with #Entity Annotaion But in my case Entity class is annotated with #Container instead of #Entity And because of that querdsl is unable to generate Q files. I am wondering is there a way to do it with #Container annotated class?
Pluggin in pom.xml
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.5.6
com.configuration
Pagination-and-filtering
0.0.1-SNAPSHOT
Pagination-and-filtering
Demo project for Spring Boot
<java.version>11</java.version>
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- https://mvnrepository.com/artifact/com.querydsl/querydsl-jpa -->
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.querydsl/querydsl-apt -->
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
My entity class
public class UserEntity {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private Integer age;
private String profession;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
}
Well according to the documentation, you might be able to achieve this using 2 options:
Option 1: querydsl.unknownAsEmbeddable
set where unknown non-annotated classes should be treated as
embeddable (default: false)
https://querydsl.com/static/querydsl/3.1.2.BUILD/reference/html/ch03s03.html
Example of Usage:
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
<options>
<querydsl.entityAccessors>true</querydsl.entityAccessors>
<querydsl.listAccessors>false</querydsl.listAccessors>
<querydsl.useGetters>true</querydsl.useGetters>
<querydsl.unknownAsEmbeddable>true</querydsl.unknownAsEmbeddable>
</options>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
</dependencies>
</plugin>
Option 2: Using #QueryEntities(ClassWithContainerAnnotation.class)
https://querydsl.com/static/querydsl/4.4.0/apidocs/com/querydsl/core/annotations/QueryEntities.html
Example package-info.java
#com.querydsl.core.annotations.QueryEntities({com.onescorpin.jpa.AbstractAuditedEntity.class, com.onescorpin.jpa.AbstractAuditedEntityAsMillis.class})
package com.onescorpin.metadata;
Ref: https://github.com/wcandy0088/nova/blob/master/nova-new1/core/operational-metadata/operational-metadata-jpa/src/main/java/com/onescorpin/metadata/package-info.java

AspectJ execution pointcut on same method throwing NPE [duplicate]

I have 2 aspects that are applied on the same method.
When the method executes correctly I have no problem, everything is working fine and both aspects work as expected.
The problem is when the method throw an exception. In these cases, the first aspect re-throw correctly the exception, but the second aspect is generating a nullpointerexception.
I was able to reproduce the problem isolating the case on a unit test in a separated project.
Those are the aspects (actually I removed all the logic, at the moment they do nothing):
#Aspect
public class LogContextConstantAspect {
#Around("execution(* *(..)) && #annotation(logContextConstant)")
public Object aroundMethod(ProceedingJoinPoint joinPoint, LogContextConstant logContextConstant) throws Throwable {
try {
Object res = joinPoint.proceed();
return res;
} catch (Throwable e) {
throw e;
}
}
}
and
#Aspect
public class LogExecutionTimeAspect {
#Around("execution(* *(..)) && #annotation(logExecutionTime)")
public Object around(ProceedingJoinPoint joinPoint, LogExecutionTime logExecutionTime) throws Throwable {
try {
Object res = joinPoint.proceed();
return res;
} catch (Throwable e) {
throw e;
}
}
}
while those are the 2 custom annotation that I implemented
#Retention(RetentionPolicy.RUNTIME)
#Target(ElementType.METHOD)
public #interface LogExecutionTime {
String paramKey() default "execution_time";
}
#Retention(RetentionPolicy.RUNTIME)
#Target({ElementType.METHOD, ElementType.TYPE})
#Documented
public #interface LogContextConstant {
String name();
String value();
}
then I created a simple class with the following methods
public class AspectSimple {
public int execute() {
System.out.println("ok");
return 1;
}
public int failSimple() throws CustomException {
throw new CustomException("ko");
}
#LogExecutionTime
public int failWithAspect1() throws CustomException {
throw new CustomException("ko");
}
#LogContextConstant(name="test", value = "test")
public int failWithAspect2() throws CustomException {
throw new CustomException("ko");
}
#LogExecutionTime
#LogContextConstant(name="test", value = "test")
public int executeWithAspect() {
return 1;
}
#LogExecutionTime
#LogContextConstant(name="test", value = "test")
public int failWithAspect3() throws CustomException {
throw new CustomException("ko");
}
}
and finally this unit test
public class TestSample {
static AspectSimple as = null;
#BeforeAll
public static void setup() {
as = new AspectSimple();
}
#Test
public void test1() {
int res = as.execute();
assertEquals(1, res);
}
#Test
public void test2() {
int res = as.executeWithAspect();
assertEquals(1, res);
}
#Test
public void test3() {
try {
int res = as.failSimple();
} catch (CustomException e) {
assertNotNull(e);
} catch (Exception e) {
fail();
}
}
#Test
public void test4() {
try {
int res = as.failWithAspect1();
} catch (CustomException e) {
assertNotNull(e);
} catch (Exception e) {
fail();
}
}
#Test
public void test5() {
try {
int res = as.failWithAspect2();
} catch (CustomException e) {
assertNotNull(e);
} catch (Exception e) {
fail();
}
}
#Test
public void test6() {
try {
int res = as.failWithAspect3();
} catch (CustomException e) {
assertNotNull(e);
} catch (Exception e) {
fail();
}
}
}
All tests are running correctly, only the last one (test6) fails.
the application is running on java 8, with aspectj 1.9.4 and junit 5.
Here the complete pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.pivimarco.samples.aspects</groupId>
<artifactId>aspect-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
org.baeldung.executable.ExecutableMavenJar
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
</includes>
<properties>
<excludeTags>slow</excludeTags>
</properties>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</execution>
</executions>
<configuration>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
</includes>
<properties>
<excludeTags>slow</excludeTags>
</properties>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<target>1.8</target>
<source>1.8</source>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.11</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
<configuration>
<source>1.8</source>
<target>1.8</target>
<proc>none</proc>
<complianceLevel>1.8</complianceLevel>
</configuration>
</plugin>
</plugins>
</build>
</project>
If I apply just a single aspect the CustomException is throwed as aspected,
but when both aspects are applied I'm getting a nullpointerexception.
I've also tried to declare the precedence of the aspects, using DeclarePrecedence annotation, but it didn't work
#DeclarePrecedence("it.pivimarco.samples.aspects.LogContextConstantAspect,it.pivimarco.samples.aspects.LogExecutionTimeAspect")
This is the stacktrace of the NPE
java.lang.NullPointerException
at it.pivimarco.samples.aspects.AspectSimple.failWithAspect3_aroundBody10(AspectSimple.java:35)
at it.pivimarco.samples.aspects.AspectSimple$AjcClosure11.run(AspectSimple.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:170)
at it.pivimarco.samples.aspects.LogContextConstantAspect.aroundMethod(LogContextConstantAspect.java:18)
at it.pivimarco.samples.aspects.AspectSimple.failWithAspect3(AspectSimple.java:35)
at it.pivimarco.samples.aspects.TestSample.test6(TestSample.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
I think you uncovered a bug in the AspectJ compiler (versions 1.9.3, 1.9.4) which does not occur in version 1.9.2, as I said in my comment. I have just created AspectJ bug ticket #552687 on your behalf. Please check there for further updates. For now you can just downgrade to 1.9.2 and continue working.
Update: AspectJ 1.9.5 with the bugfix is out. Please try again. My retest was successful.

liquibase:diff not giving me expected result

I have a JPA entity called customer and goes like this
#Entity
public class Customer {
private int custNo;
private String custName;
private String country;
public Customer() {
}
public Customer(int custNumber, String custName, String country) {
this.custNo = custNumber;
this.custName = custName;
this.country = country;
}
public int getCustNo() {
return custNo;
}
public void setCustNo(int custNo) {
this.custNo = custNo;
}
public String getCustName() {
return custName;
}
public void setCustName(String custName) {
this.custName = custName;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
}
and my db has 2 tables :- BE132_name and BE1jj231_address ,
I am running my profile liquibase:diff and is giving me the change set as follows
<changeSet author="jobs (generated)" id="1554122585461-10">
<dropTable tableName="BE132_name"/>
</changeSet>
<changeSet author="jobs (generated)" id="1554122585461-11">
<dropTable tableName="BE1jj231_address"/>
</changeSet>
As you can see it created drop table since I dont have its corresponding JPA entities. But why is it not creating the create script for my Customer ?
For an empty data base (one without any tables) , I am getting
INFO 4/2/19 5:47 PM: liquibase: No changes found, nothing to do
I used the liquibase-hibernate plugin for this!. It is capable of generating the changeset for a JPA entity even if its corresponding table is not there in the db.
The plugin
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate4</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.7.3.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
and the liquibase.properties
changeLogFile=classpath:liquibase-changeLog.xml
url=jdbc:mysql://localhost:3306/oauth_reddit
username=tutorialuser
password=tutorialmy5ql
driver=com.mysql.jdbc.Driver
referenceUrl=hibernate:spring:org.baeldung.persistence.model
?dialect=org.hibernate.dialect.MySQLDialect
diffChangeLogFile=src/main/resources/liquibase-diff-changeLog.xml
The referenceUrl is using package scan, so the dialect parameter is required. changeLogFile is the location of changeset for which the db is in sync. diffChangeLogFile is the location where the difference changelog has to be flushed.

initializationError in Eclipse when #PrepareForTest is at method but at class

Small example, using jUnit 4.11, Mockito 2.6.3, PowerMock 1.7.0RC4:
public class TheClass {
public static int giveMeNumber() {
return 70;
}
public static int giveMeThatNumber(int it) {
return it;
}
}
and
import org.junit.Test;
import org.junit.runner.*;
import org.mockito.*;
import org.powermock.api.mockito.*;
import org.powermock.core.classloader.annotations.*;
import org.powermock.modules.junit4.PowerMockRunner;
#RunWith(PowerMockRunner.class)
// #PrepareForTest(TheClass.class)
public class TheTestClass {
#Test
#PrepareForTest(TheClass.class)
public void test1() {
PowerMockito.mockStatic(TheClass.class);
Mockito.when(TheClass.giveMeNumber()).thenReturn(13);
System.out.println(TheClass.giveMeNumber());
}
#Test
#PrepareForTest(TheClass.class)
public void test2() {
PowerMockito.mockStatic(TheClass.class);
Mockito.when(TheClass.giveMeThatNumber(25)).thenReturn(50);
System.out.println(TheClass.giveMeThatNumber(25));
}
#Test
public void test3() {
System.out.println("Hey, I do not want a #Prepare...d class!");
}
}
The dependencies are loaded with Maven, the pom.xml is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>stackoverflow.bowi</groupId>
<artifactId>place.of.prepareForTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Place of PrepareForTest</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<powermock.version>1.7.0RC4</powermock.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.6.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
When I run those tests in eclipse (right click at class name, Run as..., JUnit test), they pass (not actually checking anything, I know :-) ). When I run them alone (right click at method name, Run as..., JUnit test), they fail with an initializationError [Runner: JUnit 4] (0,000s) without any trace.
Strangely, when I remove the #PrepareForTest(TheClass.class) from the method signatures and uncomment it in the class signature, all three run fine both together and alone.
But now look: test3() says it does not want a "prepared" TheClass. What I thought was correct, is to move the #PrepareForTest(TheClass.class) from the class signature to the signatures of the methods that need it (test1() and test2()), like it was before but failed.
What am I doing wrong?