Showing posts with label template. Show all posts
Showing posts with label template. Show all posts

Tuesday, July 1, 2014

More Useful Eclipse Templates

I was moving to Eclipse Luna and I realized I didn't export my templates from kepler.  Here are some useful ones, besides the ones I've posted about before.



And for convenience here is an import xml you can use to load all my favorites.

Wednesday, June 26, 2013

Eclipse Template: HashCode and Equals with Apache Commons EqualsBuilder and HashCodeBuilder

So I really like eclipse's ability to write code for me, especially the really boring stuff that no one should have to write, but their way of doing hashCode and equals is pretty messy looking. Apache Commons has some tools to clean it up but it doesn't make it quite as easy to have eclipse generate it for you. But, here is a template that should make life a little easier.

As a reminder you add templates by Window -> Preferences -> Java -> Editor -> Templates then clikc on the 'New' button
More info can be found here

Wednesday, March 28, 2012

Create a custom Eclipse Template @RunWith(MockitoJUnitRunner.class)

I got sick of typing out the @RunWith for mockito support on my test cases so I created a template to autocomplete it for me. And yes you can make a template for anything you want.

First go to Java -> Editor -> Templates



Click on New then enter this into the text box:
${:import(org.mockito.runners.MockitoJUnitRunner, org.junit.runner.RunWith)} @RunWith(MockitoJUnitRunner.class)

And here are some more awesomely useful templates.