Posts tagged with "tips"

Mar 27th, 2014

How to write better Jasmine tests with mocks

Jasmine project logo

I recently started using Jasmine to write my JavaScript tests. I really like it – it made writing tests actually kind of fun. I especially love that you can write tests with mocks in a similar manner as you would using Mockito in the Java world. A mock is basically a lightweight object that imitates [...]

Leave a Comment
Mar 7th, 2014

How to get the “Push to Gerrit” Action back with EGit

This week I updated my IDE to Eclipse 4.3.2 which comes with Egit 3.2. After that my “Push to Gerrit” action was gone from the usual place. If the same thing happens to you, here is how to get it back: In the context menu, select Team > Remote > Configure Push to Upstream. In [...]

1 Comment
Feb 10th, 2014

SWT Best Practices: Changing Fonts

Here is a widespread way of creating a label with a bold font: Everything seems to be fine with this code. A Label is created with the default font “Arial”, the default size “12″ and our desired style “BOLD”. So what’s the problem with this snippet? With the above code that creates a BOLD font, you [...]

7 Comments
Dec 6th, 2013

Run UI tests in the background on Linux

UI tests on a virtual display

When you run JUnit tests that open windows and dialogs, all these windows pop up on your screen like fireworks, making your desktop unusable for minutes. If you’re lucky enough to work on Linux, there’s an easy way to get rid of all the flickering. You can simply redirect your UI tests onto a virtual [...]

3 Comments
Nov 6th, 2013

Get rid of your StringUtils!

5480421664_b545d6083c_n

Probably every Java developer has developed at least one String utility class in his life. Need a proof? Feed "java StringUtil" to your favorite search engine – I found 20 different implementations among the first 30 search hits only! There is a simple reason for that – Strings are used quite frequently in common Java [...]

9 Comments
Sep 24th, 2013

Execution of JUnit Tests in a Single-Sourced Application

PagesScreenSnapz022

One strength of Eclipse is the possibility to use the same code on desktop clients as well as in web clients. The same application can run as an installed desktop application and in the web browser, with only few adjustments for both platforms. In our experience, about 80% to 90% of the code can run [...]

Leave a Comment
Aug 19th, 2013

Mutable variable capture in anonymous Java classes

The Java compiler requires local variables of enclosing contexts referenced in anonymous classes (so-called captured variables) to be final. What if the anonymous class wants to alter the value of the variable, i.e. requires the variable to be mutable? This post shows different ways how to achieve that. The problem Let’s assume we have a [...]

2 Comments
Aug 13th, 2013

Eclipse Preferences You Need to Know

browser

Lately there have been many discussions regarding Eclipse preferences because of sites like ihateeclipse.com. The Number 1 complaint on this site is that Eclipse’s resources get out of sync with the file system and, as a result, the user has to press F5. I’ve also run into this more than once ;). Anyway, since I’m [...]

8 Comments
Aug 12th, 2013

Optimizing Images for Mobile, Native and Web Apps

Nowadays applications are expected to provide a better look & feel than ever before. This trend is not limited to mobile apps – desktop and web applications need keep up as well. A common solution is the extended use of images and graphics. But all the shiny pixels can take up quite a bit of [...]

1 Comment