Link: Advanced Usage of JUnit Theories, Multiple DataPoints, and ParameterSuppliers

It is surprising how difficult it is to find documentation for some JUnit features such as Theories. May be they haven't bothered to write it because it is still considered "experimental" (even though included in JUnit since 4.4). As usually we have to rely on Jens Schauder's blog
Continue reading →

JUnit Tip: Verifying that an Exception with a Particular Message was Thrown

JUnit has a hidden treasure which makes it easy to do something we have long longed for - namely not only to verify that an exception of a particular type has been thrown but also that its message contains the expected message. The hidden pearl is the @Rule ExpectedException and its JavaDoc documents well how to use it (slightly modified):


Continue reading →

Correct your URL

The page you want to access is Practical Introduction into Code Injection with AspectJ, Javassist, and Java Proxy
Continue reading →

Practical Introduction into Code Injection with AspectJ, Javassist, and Java Proxy

The ability to inject pieces of code into compiled classes and methods, either statically or at runtime, may be of immense help. This applies especially to troubleshooting problems in third-party libraries without source codes or in an environment where it isn't possible to use a debugger or a profiler. Code injection is also useful for dealing with concerns that cut across the whole application, such as performance monitoring. Using code injection in this way became popular under the name Aspect-Oriented Programming (AOP). Code injection isn't something used only rarely as you might think, quite the contrary; every programmer will come into a situation where this ability could prevent a lot of pain and frustration.

This post is aimed at giving you the knowledge that you may (or I should rather say "will") need and at persuading you that learning basics of code injection is really worth the little of your time that it takes. I'll present three different real-world cases where code injection came to my rescue, solving each one with a different tool, fitting best the constraints at hand.


Continue reading →

DRY: Use JUnit @Rule Instead of Repeating Setup/@Before in Each Test

I was for a long time unhappy that DbUnit Express users have to create a @Before method in each test just to get the test database initialized. Fortunately since version 1.3.0 they don't need to do it anymore thanks to JUnit Rules (if you are not familiar with them, they are an alternative to @Before/@After and @BeforeClass/@AfterClass, read this rules introduction).

As true coders you are certainly annoyed by so many words so let get to the source code.


Continue reading →

DbUnit Express 1.3 is Even Easier to Use and Still Better

The DbUnit Express
Continue reading →

Most interesting links of August

Recommended Readings


Continue reading →

DbUnit Express Tips: Setup Simplification, Custom Data File Convention

I've recently introduced here DbUnit Express, a wrapper around DbUnit intended to get you started with testing DB-related code in no time, and now I'd like to share two productivity tips: simplifying db tester setup with a parent test and implementing your own convention for data set files, for example one data set per test class.


Continue reading →

A Funny Story about the Pain of Monthly Deployments

The end of our one-month iteration approached and the levels of fear and agitation started to rise. What will happen when we deploy it? Will everything crash? Will all hell break loose? Will there be a flood of midnight severity-one issues? Will the features developed work together or are there going to be unexpected and fatal interactions?

Continue reading →

Most interesting links of July

Recommanded Readings


Continue reading →

Experiencing JSF 1.2: Good but Needs a Framework

I've got an opportunity to experiment with JSF 1.2 while preparing a lecture about DbUnit Express
Continue reading →

Simple Logging HTTP Proxy with Grinder

Sometimes I need to observe HTTP communication between my and another machine. I usually use Eclipse' integrated TCP/IP monitor for it's simple and does its job well but today for a large response it just displayed "The HTTP content is too large to display." so I started searching for alternatives and found the Grinder TCPProxy
Continue reading →

Having Database Test Ready in 10 Minutes with DbUnit Express

Update: The project has been renamed to dbunit-express.

DbUnit Express is my wrapper around DbUnit that intends to make it extremely easy to set up a test of a code that interacts with a database. It is preconfigured to use an embedded Derby database (a.k.a. JavaDB, part of SDK) and uses convention over configuration to find the test data. It can also with one call create the test DB from a .ddl file. Aside of simplifying the setup it contains few utilities to make testing easier such as getDataSource() (essential for testing Spring JDBC) and RowComparator.

Originally I was using DbUnit directly but I found out that for every project I was copying lot of code and thus I decided to extract it into a reusable project. Since that it has further grown to be more flexible and make testing even easier.

Here are the seven easy steps to have a running database test:
Continue reading →

Ivy: Retrieve Both .jar And -sources.jar Into A Folder - Note to Self

After some experimenting I've found out how to tell Ivy (2.2.0) to retrieve also .jar with source codes into a folder:

Continue reading →

Going to Present "Programmer's Survival Kit: Code Injection for Troubleshooting" at JavaZone 2011

I'm going to hold a lightning talk called Programmer's Survival Kit: Code Injection for Troubleshooting
Continue reading →

Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob