BAEL-2841 updated test cases and test data
This commit is contained in:
parent
bbce155a78
commit
7bb364a2f2
@ -16,7 +16,7 @@ public class JpaPopulators {
|
||||
@Bean
|
||||
public Jackson2RepositoryPopulatorFactoryBean getRespositoryPopulator() throws Exception {
|
||||
Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean();
|
||||
factory.setResources(new Resource[] { (Resource) new ClassPathResource("fruit-data.json") });
|
||||
factory.setResources(new Resource[] { new ClassPathResource("fruit-data.json") });
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fruit>
|
||||
<id>3</id>
|
||||
<name>mango</name>
|
||||
<color>yellow</color>
|
||||
<id>1</id>
|
||||
<name>apple</name>
|
||||
<color>red</color>
|
||||
</fruit>
|
||||
|
@ -23,31 +23,16 @@ public class FruitPopulatorTest {
|
||||
public void givenFruitJsonPopulatorThenShouldInsertRecordOnStart() {
|
||||
|
||||
List<Fruit> fruits = fruitRepository.findAll();
|
||||
assertEquals("record count is not matching", 3, fruits.size());
|
||||
assertEquals("record count is not matching", 2, fruits.size());
|
||||
|
||||
fruits.forEach(fruit -> {
|
||||
if (1 == fruit.getId()) {
|
||||
assertEquals("This is not an apple", "apple", fruit.getName());
|
||||
assertEquals("It is not a red colored fruit", "red", fruit.getColor());
|
||||
assertEquals("apple", fruit.getName());
|
||||
assertEquals("red", fruit.getColor());
|
||||
} else if (2 == fruit.getId()) {
|
||||
assertEquals("This is not a guava", "guava", fruit.getName());
|
||||
assertEquals("It is not a green colored fruit", "green", fruit.getColor());
|
||||
assertEquals("guava", fruit.getName());
|
||||
assertEquals("green", fruit.getColor());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenFruitXmlPopulatorThenShouldInsertRecordOnStart() {
|
||||
|
||||
List<Fruit> fruits = fruitRepository.findAll();
|
||||
assertEquals("record count is not matching", 3, fruits.size());
|
||||
|
||||
fruits.forEach(fruit -> {
|
||||
if (3 == fruit.getId()) {
|
||||
assertEquals("This is not a mango", "mango", fruit.getName());
|
||||
assertEquals("It is not a yellow colored fruit", "yellow", fruit.getColor());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user