Category: Java

TestNG Basics

Unit tests are written to ensure that small units of code function as intended. When it comes to Unit tests, the higher your code coverage, the higher your confidence when refactoring and/or extending code functions and features. Unit tests play an incredibly important role when it comes to sustaining and maintaining code. TestNG is a simple, yet powerful unit test framework for Java. TestNG enables you to construct test cases...

Java Impersonation using JNA and Waffle

Have you ever had the need to create a Java application that executes on behalf of a logged in Windows user? You can! In this post we will use JNA and Waffle to: Create a simple Java application to impersonate a Windows domain user. In a future post, we will see how this can also be done in a servlet! 1. Create a Java application to impersonate a Windows domain...

Java Getters and Setters with Lombok

Sick of all the boilerplate code required to create simple getter/setters with Java? Checkout project Lombok! Let’s suppose we want to create a simple class with the following: public getter/setter for age protected setter for name With Vanilla Java, we might do the following: However, with Lombok (we remove most of the cruft) and we simply write: How cool?!?! Thank you!

Debugging a Java application… Remotely!

Have you ever had the need to debug a Java application remotely? You can! This post describes how you can do using Java and Eclipse. Let’s start by describing some important  Java remote debugging parameters that we’ll make use of later. transport=dt_socket instructs the JVM that the debugger connections will be made through a socket address=8998 opens port number 8998 for use by the debug session suspend=y starts the JVM in...

How to programmatically set Java Logging defaults and override these defaults using logging.properties

The Java Logging APIs provide a number of properties for create and configuring  Java loggers.  If you plan to create a new Java Logger for your project, it may be very desirable to define a default configuration you logger and handlers. It is also desirable to enable users to override these defaults using the JVM logging.properties file. Why is this desirable? The JVM logging.properties ships with a default configuration. This...

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: