Home » Java » Enterprise Java

Enterprise Java

Testing using mocks

java-interview-questions-answers

Mock objects are very useful if used right way. I shared some of the experience of using Mock Objects in need-driven-software-development-using post. In this post i share 2 things– Contract based testing using mocks.– Patterns to organized mock code. Contract based testing Lets take scenario where you are building Money remittance service. Key component in such type of service is Currency Converter , ...

Read More »

Possible ways to use Arquillian in Jakarta EE TCKs

Recently, we had a discussion how to create a standalone Jakarta Batch test kit (TCK). For most of the committers, it’s pretty natural to use Arquillian to abstracts tests away from how they are executed on an implementation. But Romain proposed an intriguing idea to use plain JUnit5 that got me thinking. And it didn’t stop with thinking. After a ...

Read More »

Constraint Streams – Modern Java constraints without the Drools Rule Language

Traditionally, to scale out with OptaPlanner, you had to learn DRL. No more. With the new Constraints Streams API, inspired by Java 8 Streams and SQL, you can now write your constraints in Java (or Kotlin or Scala) and still benefit from incremental calculation. Underneath, Constraints Streams (CS) still use the powerful Drools engine. We also still fully support score ...

Read More »

Qute Templates with Quarkus

java-interview-questions-answers

Quarkus ships with its own templating engine, Qute, which already includes an interesting set of features. In the following video, I’m showing the basic usage of action-based MVC with JAX-RS that forwards our requests to HTML templates. To try out Qute yourself, have a look at the following resources: Example projectQute Templating Engine GuideQute Reference Guide Published on Java Code ...

Read More »

Quarkus on OpenJ9 JVM & resource consumption

java-interview-questions-answers

Besides the native mode, Quarkus also runs well in JVM mode which comes with its own advantages. You can use an alternative JVM, such as OpenJ9 which gives you better resource consumption. In the following video I’ll show how easy it is to swap the JVM. In the video, I’m using the Docker image adoptopenjdk/openjdk14-openj9 in one of the latest ...

Read More »

Quickly creating URIs with UriBuilder

java-interview-questions-answers

If you have access to the JAX-RS API and an implementation in your projects (many do), then you can use JAX-RS’ UriBuilder to conveniently create URIs via builder pattern using resolvable placeholder. Have a look at the following example: 1 2 3 4 5 6 7 String host = System.getProperty("host", "localhost"); String port = System.getProperty("port", "8080");   URI uri = ...

Read More »

Quarkus’ additional (non-standard) CDI features

java-interview-questions-answers

Quarkus supports CDI (Contexts and Dependency Injection) 2.0, but not all of it, only the most common features. However, Quarkus does include some non-standard features that can come in quite handy to developers which I want to show in the following video. Whether or not you’re familiar with CDI, if you use Quarkus you should have a look at the ...

Read More »