I am new at JUnit. I try to write unit test of a simple service class which is "ProductService". Here is my test codes for "ProductService"
public interface TestProductService {
void shouldCreateProduct() throws EntityIsAlreadyCreatedException;
void shouldDeleteProductById() throws EntityNotfoundException;
void shouldUpdateProduct();
void shouldFindProductById() throws EntityNotfoundException;
void shouldFindAllProducts() throws EntityNotfoundException;
void shouldThrowErrorWhenFindAllProductsWhichAreNotInDB();
void shouldThrowErrorWhenFindProductWhichAreNotInDB() throws EntityNotfoundException;
void shouldThrowErrorWhenDeleteProductWhichIsNotInDB() throws EntityNotfoundException;
void shouldThrowErrorWhenCreateProductWhichIsAlreadyInDB() throws EntityIsAlreadyCreatedException;
}
As you see, there are some functions which can throw error. In addition, other functions test simple "CRUD" operations. Should I seperate the functions which can throw error to another interface ? If I seperate them, can I provide to interface segregation ? Thanks your help.