Testing Delegate Methods

Posted on Fri 15 April 2016 in General Software Development, Testing • Tagged with delegate method, J. B. Rainsberger, JUnit, unit testing

We had an interesting discussion the other day: should we write unit tests for delegate methods, that is, methods that only delegate the call to a delegate object? Here's an example of such a method:

public void do(Object o1, Object o2) {
    delegate.do(o1,o2);
}

I said I did …


Continue reading

Headless Testing with TestFX

Posted on Mon 11 April 2016 in JavaFX, Testing • Tagged with Eclipse, headless, JavaFX, Maven, Monocle, TestFX

Jérome Cambon wrote a nice introduction to TestFX and how to enable the headless mode using Monocle.

I tried to reproduce the steps he described for running my TestFX GUI tests in headless mode from Eclipse so I can keep using my mouse while they are running. The crux is …


Continue reading

A Potential Pitfall with the TextFormatter Class in JavaFX

Posted on Thu 07 April 2016 in JavaFX • Tagged with anchor, caret, cursor, eszett, Java, JavaFX, string conversion, text field, text formatter

A common use case for the TextFormatter class in JavaFX is a text field that should convert any lower-case character input into an upper-case character. This can be achieved easily by defining a filter for the text formatter as described here. A straightforward implementation could look like this:

private UnaryOperator …

Continue reading

The TextFormatter Class in JavaFX: How to Restrict User Input in a Text Field

Posted on Tue 05 April 2016 in JavaFX • Tagged with change listener, event, JavaFX, Richard Bair, text field, text formatter

There are a lot of code examples for restricting or modifying user input into a JavaFX text field. Most examples I have seen suggest adding a change listener to the text field's text property. Here's how you would allow only lower-case characters in your text field using the change listener …


Continue reading

Owncloud with Apache 2.4, PHP FPM, and Plesk

Posted on Mon 04 April 2016 in Sysadmin • Tagged with Apache, HTTP, SSL, Owncloud, PHP, Plesk

After about two weeks of fiddling around, I finally managed to get my own instance of owncloud up and running with Apache behind Plesk. Here's how I did it:

  1. Set up a sub-domain in Plesk, e.g. owcloud.mydomain.com
  2. Set up a database for owncloud using Plesk.
  3. Make sure …


Continue reading

How to Make Unit Tests more Likeable

Posted on Mon 04 April 2016 in General Software Development, Testing • Tagged with argument captor, dummy, JUnit, mock, Mockito, spy, stub, unit testing

What are these unit tests good for? Are we testing Mockito?

This is what a colleague asked another colleague a couple of days ago. He was referring to some rather complicated and long unit tests that used a lot of mocks and verify statements. I knew what he was talking …


Continue reading

Adding JavaFX Properties to a DTO

Posted on Mon 21 March 2016 in JavaFX • Tagged with annotations, DTO, FXForm2, JavaFX, JSR 303, UI, Wrapper

Now that I have understood what a DTO is good for, I'm thinking about ways to improve it. As they are right now, our DTOs are POJOs extended by JSR 303 annotations for defining constraints on their fields/methods. The annotations are duplicates of the annotations defined on the corresponding …


Continue reading

What's up with DTOs?

Posted on Sat 19 March 2016 in Design Patterns • Tagged with Adam Bien, DTO, Eclipse RCP, EMF, JavaEE, Martin Fowler

Having worked a lot with EMF and Eclipse RCP applications based on EMF as the framework of choice for transferring domain models into code, I never got in touch with real-life examples of Data Transfer Objects (DTOs). I was familiar with the pattern in theory, but I never saw a …


Continue reading

Any Complaints?

Posted on Wed 16 March 2016 in General Software Development • Tagged with complaints, Twitter

https://twitter.com/phillip_webb/status/705909774001377280

I usually go for "too much boilerplate".


Can There Be Too Much of a Good Thing?

Posted on Wed 16 March 2016 in Design Patterns • Tagged with Java, JavaFX, UI

I recently worked on JavaFX UI code that was new to me. In order to extend the existing UI by a simple label, I needed access to a bean of the underlying data model. Much to my surprise, I had to dig deep to find it hidden under multiple layers …


Continue reading