Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Test
- public void readFileTest(){
- BufferedReader bufferedReader = null;
- try {
- InputStream in = getInstrumentation().getContext().getResources().getAssets().open("test1.csv");
- bufferedReader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
- String line = bufferedReader.readLine();
- } catch (IOException e) {
- fail("IOException on file");
- }
- }
- @Test(timeout = 100)
- public void openValidFileOnDevice() {
- MyComponent component = new MyComponent();
- FileObserver fileObserver = new FileObserver(VALID_FILE) {
- @Override
- public void onEvent(int i, String s) {
- assertTrue(true);
- }
- };
- try {
- component.open(VALID_FILE, CSVReaderWriter.Mode.READ);
- } catch (FileNotFoundException e) {
- fail("FileNotFoundException on: " + VALID_FILE);
- } catch (IOException e) {
- fail("IOException on: " + VALID_FILE);
- } catch (Exception e) {
- fail("Exception thrown, should not throw exceptions on valid file");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement