Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RunWith(SpringRunner.class)
- @ContextConfiguration(classes = {SepaRoutingUtils.class})
- public class SepaRoutingFromXMLTest {
- @Autowired
- SepaRoutingUtils sepa;
- @Test
- public void existValidOneFullXMLFileInFolder() throws Exception {
- SepaRoutingUtils sepa = new SepaRoutingUtils();
- assertThat(sepa.readSepaXMLFile(), containsString(".xml"));
- assertThat(sepa.readSepaXMLFile(), containsString("SEPAROUTING_V3_FULL_"));
- }
- }
- @Component
- public class SepaRoutingUtils {
- // @Value("${routing.folder}")
- // private String SEPA_FOLDER
- private final String SEPA_FOLDER = "../../separouting";
- private File readSepaFolder() {
- File folder = new File(SEPA_FOLDER);
- if(!folder.isDirectory()) {
- throw new FolderAccessDeniedException();
- }
- return folder;
- }
- public String readSepaXMLFile() {
- try {
- return Utils.prepareXMLFile(readSepaFolder(), SepaRoutingFileType.FULL).getName();
- }
- catch (ParseException e) {
- e.printStackTrace();
- throw new NotValidFileException();
- }
- }
- }
Add Comment
Please, Sign In to add comment