Import Test Data

Now that we have the restaurant creation functionality in place, we need to populate our application with test data for development and testing purposes.

Setting Up Test Resources

First, we need to create a directory to store our test images and populate it with sample restaurant photos.

Create a new directory at src/test/resources/testdata and add the following image files:

  • golden-dragon.png
  • la-petit-maison.png
  • raj-pavilion.png
  • sushi-master.png
  • rustic-olive.png
  • el-toro.png
  • greek-house.png
  • seoul-kitchen.png
  • thai-orchid.png
  • burger-joint.png

Creating the Test Class

Let's create a test class that will help us load sample restaurant data into our application.

Create a new class at com.devtiro.restaurant.manual.RestaurantDataLoaderTest:

@SpringBootTest @Tag("manual") public class RestaurantDataLoaderTest { @Autowired private RestaurantService restaurantService; @Autowired private PhotoService photoService; @Autowired private ResourceLoader resourceLoader; @Test @Rollback(false) // Allow changes to persist public void createSampleRestaurants() throws Exception { // Test implementation provided in reference materials } }

Summary

  • Created test resources directory for sample restaurant images
  • Implemented RestaurantDataLoaderTest to populate test data
© 2026 Devtiro Ltd. All rights reserved