Skip to content

Instantly share code, notes, and snippets.

@nurkiewicz
Created December 19, 2010 16:42
Show Gist options
  • Save nurkiewicz/747467 to your computer and use it in GitHub Desktop.
Save nurkiewicz/747467 to your computer and use it in GitHub Desktop.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test-context.xml")
@Transactional
public class MainControllerTest {
//...
}
//...
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test-context.xml")
@Transactional
public class BarRepositoryTest {
//...
}
//...
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test-context.xml")
@Transactional
public class BarServiceTest {
//...
}
//...
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test-context.xml")
@Transactional
public class FooRepositoryTest {
//...
}
//...
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:test-context.xml")
@Transactional
public class FooServiceTest {
//...
}
<beans default-lazy-init="true">
pom.xml
src
|-- main
| -- java
| `-- com
| `-- blogspot
| `-- nurkiewicz
| `-- spring
| `-- test
| `-- web
| `-- MainController.java
`-- test
|-- java
| `-- com
| `-- blogspot
| `-- nurkiewicz
| `-- spring
| `-- test
| `-- web
| `-- MainControllerTest.java
`-- resources
-- com
`-- blogspot
`-- nurkiewicz
`-- spring
`-- test
`-- web
`-- MainControllerTest-context.xml
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@Transactional
public class MainControllerTest {
//...
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class MainControllerTest {
@Resource
private MainController mainController;
@Test
public void smokeTest() throws Exception {
//mainController...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment