I am not satisfied with the given answers, so here is a different answer:
First of all DI for testing is not necessarily the case, rather you need mockup data for this. To create services and interfaces which are not supposed to be such, can be invalid. Especially if you are dealing with singleton and interfaces. Testing can become hard to comprehend.
And mostly first of all, services are component implementations, that can be of different type. These components are decoupled from the software and have a reason for being implemented like such:
public class Main {
public static void main(String[] args) {
// Switch between different implementations based on conditions
// Example 1: Using the REST API implementation
UserService restApiService = new RestApiUserService();
UserController userController = new UserController(restApiService);
userController.printUserData("123"); // Outputs user from REST API
// Example 2: Using the Local Storage implementation
UserService localService = new LocalUserService();
UserController localUserController = new UserController(localService);
localUserController.printUserData("456"); // Outputs user from local storage
}
This is just one example. It could be also an implementation for different protocols. Which protocol, api, library, auth service or other services you use can vary a lot, but you wouldn't want this to makee your code hard to manage.
It could also be computation, implementation of filters, if you wanted to alter images.
Its very easy to comprehent and justify a using services and dependency injection:
public class Main {
public static void main(String[] args) {
// Create an image
Image myImage = new Image("MyPhoto.jpg");
// Using the Grayscale filter
ImageFilter grayscaleFilter = new GrayscaleFilter();
ImageProcessor grayscaleProcessor = new ImageProcessor(grayscaleFilter);
grayscaleProcessor.processImage(myImage); // Outputs: Applying grayscale filter to image: MyPhoto.jpg
// Using the Sepia filter
ImageFilter sepiaFilter = new SepiaFilter();
ImageProcessor sepiaProcessor = new ImageProcessor(sepiaFilter);
sepiaProcessor.processImage(myImage); // Outputs: Applying sepia filter to image: MyPhoto.jpg
}
Of course regarding design pattern, you might need to deal with factory, singleton, interfaces and every class needs to serve its purpose. But if you think of it, these examples make it quite clear, why you would use services.
You might want to study a bit about SOLID, and generally implementation patterns, style guide etc. so that use cases become very clear.