MockFileExistenceEvaluator.cpp 880 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-21
  6. * Changed: 2023-02-23
  7. *
  8. * */
  9. #include "MockFileExistenceEvaluator.hpp"
  10. #include <ls-std/core/exception/FileNotFoundException.hpp>
  11. #include <string>
  12. using ls::std::core::Class;
  13. using ls::std::core::FileNotFoundException;
  14. using std::string;
  15. using test::io::MockFileExistenceEvaluator;
  16. MockFileExistenceEvaluator::MockFileExistenceEvaluator(bool _fileExists) : Class("MockFileExistenceEvaluator"), fileExists(_fileExists)
  17. {}
  18. MockFileExistenceEvaluator::~MockFileExistenceEvaluator() noexcept = default;
  19. void MockFileExistenceEvaluator::evaluate()
  20. {
  21. if (!this->fileExists)
  22. {
  23. string message = this->getClassName() + " called - this is just a simulation!";
  24. throw FileNotFoundException{message};
  25. }
  26. }