Home » Core Java (page 30)

Core Java

JUnit Mockito Example

1. Introduction Methods and ways to create Unit Test cases have evolve ever since it’s introduction. New tools and API´s are now available and they provide a more advanced scheme on creating and executing JUnit Test cases. Services have become more incubated, so creating integration test cases has been a daunting task for any developer. The introduction of this new ...

Read More »

JUnit Test Order Example

1. Introduction One of the rarely used features in JUnit is the usage of @FixMethodOrder annotation. This is primarily used to indicate an order of test method calls in a specific JUnit Test case class. This is actually not a recommended practice cause we want method calls to be independent and arbitrary in nature. Test cases method should not be ...

Read More »

“No JUnit Tests Found” Error Solution

1. Introduction One of the first steps that developers take in order to create Unit Test case is to ensure that their environment is ready. This means that all required libraries are setup properly and that the JUnit Test cases are correctly annotated. There might be a couple of technical hiccups like proper source folder configuration in your specific IDE, ...

Read More »

JUnit Integration Test Example

1. Introduction Integration tests are test cases that test highly coupled external services. A great example of this is services in a SOA environment. In this scheme we will create services (or micro services) that are usually deployed on a different container and only exposed specific implementation of it’s own, consumed by a more sophisticated system. By rule of thumb, we ...

Read More »

Gradle War Plugin (& Tomcat) Example

In this example, we will learn how to package a WAR File and how to deploy it on Tomcat server, using Gradle War Plugin and Gradle Tomcat Plugin. 1. Introduction to Gradle War Plugin This is a basic Gradle plugin that allows packaging web applications in WAR files. This plugin adds a war task for us that we can invoke ...

Read More »

Lucene Query Parser Example

In this Example , we are going to learn about Lucene QueryParser class. Here, we go through the simple and fundamental concepts with the QueryParser Class. In my previous post, we went through the indexing, writing, searching and displaying steps for the indexing example. Here we go through the searching step i.e. more specifically the concepts with the QueryParser Class. Thus, this ...

Read More »

JUnit Best Practices

1. Introduction There are a lot of ways on how a developer can do JUnit test cases, but overall it really depends on the strategy of how a specific functional code can be tested to it’s limits. It’s the developers responsibility to introduce thorough test cases to make sure that the code is stable and ultimately does what it has ...

Read More »

Groovy Closure Example

In this example I’ll explain closures in Groovy. According to Sabesta’s nice book Concepts of Programming Languages, defining a closure is a simple matter: “a closure is a subprogram and the referencing environment where it was defined.” But explaining it is not that simple. Sabesta explains the closure as a subprogram that can be assigned to a variable or passed to ...

Read More »

JUnit NetBeans Example

1. Introduction In this post I will introduce the basics of writing and running JUnit unit tests in NetBeans IDE. Testing an application is an integral part of the development cycle, and writing and maintaining unit tests can help ensure that the individual methods in your source code work correctly. The IDE’s support for JUnit testing framework allows developers to ...

Read More »

Gradle NetBeans Example

In this example, we will explain how to integrate Gradle with NetBeans IDE and how to perform basic Gradle tasks. 1. Why use Gradle in NetBeans IDE? Gradle is a powerful tool for building and automation. It has many advantages, enabling the development of build scripts that are cross-platform and cross-IDE. You should have no problems migrating your Gradle-based applications ...

Read More »