Abstract
This chapter describes how to set up templates, utilities and any other productivity aids. Follow the steps in this chapter if you intend to contribute back to the sister projects. There's no need to perform these steps if you are just building the sister projects from source.
All of the template files described here are checked into Subversion, (at main/standards/src/main/resources). To ease distribution they are uploaded to the Star Objects sourceforge website. The templates are not versioned (other than by Subversion itself).
Like most IDEs, Eclipse allows templates to be defined for common code snippets. Star Objects provides a number of templates to assist with testing.
To import templates, go to Windows > Preferences > Java > Editor > Templates:
The JUnit4 templates provide a selection of templates to ease the writing of JUnit4-based unit tests.
The definition file is available at http://starobjects.sourceforge.net/m2-site/main/standards/resources/eclipse-junit4-templates.xml.
The templates provided are:
jubefore - creates
setUp
method annotated with
@Before
juafter - create
tearDown
method annotated with
@After
jutest - create method annotated with
@Test
juassert - create
assertThat
assertion
The JMock 2 templates provide a selection of templates to ease the writing of unit test that perform mocking using JMock 2.
The definition file is available http://starobjects.sourceforge.net/m2-site/main/standards/resources/eclipse-jmock2-templates.xml.
The templates provided are:
jmrunwith -
@RunWith(JMock.class)
jmcontext - initialize Mockery
context
object
jmmock - create a mock using
context.mock(Foor.class)
jmexpectations - create a set of
expectations using context.checking(...)