MockFileExistenceEvaluator.cpp 802 B

1234567891011121314151617181920212223242526
  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-21
  7. *
  8. * */
  9. #include "MockFileExistenceEvaluator.hpp"
  10. #include <ls-std/core/exception/FileNotFoundException.hpp>
  11. #include <string>
  12. test::io::MockFileExistenceEvaluator::MockFileExistenceEvaluator(bool _fileExists) : ls::std::core::Class("MockFileExistenceEvaluator"), fileExists(_fileExists)
  13. {}
  14. test::io::MockFileExistenceEvaluator::~MockFileExistenceEvaluator() = default;
  15. void test::io::MockFileExistenceEvaluator::evaluate()
  16. {
  17. if (!this->fileExists)
  18. {
  19. ::std::string message = this->getClassName() + " called - this is just a simulation!";
  20. throw ls::std::core::FileNotFoundException{message};
  21. }
  22. }