-
Notifications
You must be signed in to change notification settings - Fork 0
Spring Konfiguration
all4one edited this page Dec 11, 2017
·
2 revisions
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:application-context.xml" })
public class RecipeRepositoryIT {
@Inject @Rule
public DbUnitRule dbUnitRule;
@Test
@UsingDataSet(value = { "/sample/prepare.json" })
@ShouldMatchDataSet(
value = { "/sample/afterInsertNewRecipe.json" },
orderBy = { "RECIPE.UUID", "INGREDIENT.ID" })
public void shouldBeInsertNewRecipe() {
// write your test ...
}
}
<bean name="rule" class="org.anderes.edu.dbunitburner.DbUnitRule">
<constructor-arg ref="databaseTester"></constructor-arg>
</bean>
<bean name="databaseTester" class="org.dbunit.DataSourceDatabaseTester">
<constructor-arg ref="dataSource"></constructor-arg>
</bean>
<!-- Data Source: Hier am Beispiel Derby Embedded -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="url" value="jdbc:derby:memory:testDB;create=true" />
<property name="username" value="" />
<property name="password" value="" />
</bean>
<bean name="rule" class="org.anderes.edu.dbunitburner.DbUnitRule">
<constructor-arg ref="dataSource"></constructor-arg>
<constructor-arg ref="customDataTypeFactory"></constructor-arg>
</bean>
<bean name="customDataTypeFactory" class="org.anderes.edu.dbunitburner.DerbyDateDataTypeFactory"></bean>