Skip to content

Tag: inner-classes

Implement inner-class-like reference behaviour? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 months ago. Improve this question First of all, allow me to explain a “behaviour” that I observed, then I will ask in “Example” section. Inner-class-reference behaviour In Java we can

What nested class type is best suitable for Domain Events?

I am following Domain Driven Design and Clean/ Hexagonal architecture in my Java microservice. I have domain events declared in my aggregate root class as non-static nested classes. My question is whether these classes should be static nested classes or non-static nested classes(inner classes)? I used non-static nested classes but IntelliJ IDEA suggests to make them static. According to the

How to show that a Catch block for the Parent-exception will handle subclasses as well

I have met this problem. I have created a class CatHandler, with 3 inner classes (ExceptionAlpha extends Exception, ExceptionBeta extends ExceptionAlpha, ExceptionGammer extends ExceptionBeta). These three exception subclasses are empty; they contain no code. All code should be written in CatHandler. Now the question is to write some code in CatHandler to show that ExceptionBeta and ExceptionGammer will be caught

Could not find @BeforeEach setup() method on @Nested test class in @QuarkusTest

summary On Junit Jupiter the Quarkus test extension seems to not find @BeforeEach setup methods for nested test classes and produces an error: java.lang.RuntimeException: Could not find method void com.stackoverflow.examples.nestedtestwithquarkus.NestedTestWithQuarkus.setup() on test class Is that a bug, a feature or am I missing something important? edit 1: It seems like there’s an issue with nested tests in general. Some tests

Java Inner Classes

I’m new to Java and have the following question regarding inner classes: When implementing an inner class, do I need to declare its attributes and methods scope i.e. public, private, protected? EDIT:…