Guest User

Untitled

a guest
Mar 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. @RunWith(SpringRunner.class)
  2. @ContextConfiguration(classes = {SepaRoutingUtils.class})
  3. public class SepaRoutingFromXMLTest {
  4.  
  5. @Autowired
  6. SepaRoutingUtils sepa;
  7.  
  8. @Test
  9. public void existValidOneFullXMLFileInFolder() throws Exception {
  10. SepaRoutingUtils sepa = new SepaRoutingUtils();
  11. assertThat(sepa.readSepaXMLFile(), containsString(".xml"));
  12. assertThat(sepa.readSepaXMLFile(), containsString("SEPAROUTING_V3_FULL_"));
  13. }
  14.  
  15. }
  16.  
  17. @Component
  18. public class SepaRoutingUtils {
  19.  
  20. // @Value("${routing.folder}")
  21. // private String SEPA_FOLDER
  22. private final String SEPA_FOLDER = "../../separouting";
  23.  
  24. private File readSepaFolder() {
  25.  
  26. File folder = new File(SEPA_FOLDER);
  27. if(!folder.isDirectory()) {
  28. throw new FolderAccessDeniedException();
  29. }
  30.  
  31. return folder;
  32. }
  33.  
  34. public String readSepaXMLFile() {
  35.  
  36. try {
  37. return Utils.prepareXMLFile(readSepaFolder(), SepaRoutingFileType.FULL).getName();
  38. }
  39. catch (ParseException e) {
  40. e.printStackTrace();
  41. throw new NotValidFileException();
  42. }
  43.  
  44. }
  45.  
  46. }
Add Comment
Please, Sign In to add comment