Projects >> cgeo >>dc30da9a8b2d430152e125512e37fefe4d25008c

Chunk
Conflicting content
        assertEquals(GPXImporter.IMPORT_STEP_FINISHED_WITH_ERROR, importStepHandler.messages.get(1).what);
    }

<<<<<<< HEAD
    static class TestHandler extends Handler {
=======
    public void testImportGpxCancel() throws IOException {
        File gc31j2h = new File(tempDir, "gc31j2h.gpx");
        copyResourceToFile(R.raw.gc31j2h, gc31j2h);

        progressHandler.cancel();
        GPXImporter.ImportGpxFileThread importThread = new GPXImporter.ImportGpxFileThread(gc31j2h, listId, importStepHandler, progressHandler);
        importThread.run();
        importStepHandler.waitForCompletion();

        assertEquals(2, importStepHandler.messages.size());
        assertEquals(GPXImporter.IMPORT_STEP_READ_FILE, importStepHandler.messages.get(0).what);
        assertEquals(GPXImporter.IMPORT_STEP_CANCELED, importStepHandler.messages.get(1).what);
    }

    private void copyResourceToFile(int resourceId, File file) throws IOException {
        final InputStream is = getInstrumentation().getContext().getResources().openRawResource(resourceId);
        final FileOutputStream os = new FileOutputStream(file);

        try {
            byte[] buffer = new byte[4096];
            int byteCount;
            while ((byteCount = is.read(buffer)) >= 0) {
                os.write(buffer, 0, byteCount);
            }
        } finally {
            os.close();
            is.close();
        }
    }

    static class TestHandler extends CancellableHandler {
>>>>>>> 759f158b115fe27f7c61409d5f540d1effb6c0e1
        private final List messages = new ArrayList();
        private long lastMessage = System.currentTimeMillis();
Solution content
        assertEquals(GPXImporter.IMPORT_STEP_FINISHED_WITH_ERROR, importStepHandler.messages.get(1).what);
    }

    public void testImportGpxCancel() throws IOException {
        File gc31j2h = new File(tempDir, "gc31j2h.gpx");
        copyResourceToFile(R.raw.gc31j2h, gc31j2h);

        progressHandler.cancel();
        GPXImporter.ImportGpxFileThread importThread = new GPXImporter.ImportGpxFileThread(gc31j2h, listId, importStepHandler, progressHandler);
        importThread.run();
        importStepHandler.waitForCompletion();

        assertEquals(2, importStepHandler.messages.size());
        assertEquals(GPXImporter.IMPORT_STEP_READ_FILE, importStepHandler.messages.get(0).what);
        assertEquals(GPXImporter.IMPORT_STEP_CANCELED, importStepHandler.messages.get(1).what);
    }

    static class TestHandler extends CancellableHandler {
        private final List messages = new ArrayList();
        private long lastMessage = System.currentTimeMillis();
File
GPXImporterTest.java
Developer's decision
Combination
Kind of conflict
Class signature
Method declaration
Chunk
Conflicting content
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.R;

<<<<<<< HEAD
import android.os.Handler;
=======
import android.content.res.Resources;
import android.test.InstrumentationTestCase;
>>>>>>> 759f158b115fe27f7c61409d5f540d1effb6c0e1

import java.io.IOException;
import java.io.InputStream;
Solution content
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.R;

import java.io.IOException;
import java.io.InputStream;
File
GPXParserTest.java
Developer's decision
None
Kind of conflict
Import
Chunk
Conflicting content
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.R;

<<<<<<< HEAD
import android.os.Handler;
=======
import android.content.res.Resources;
import android.test.InstrumentationTestCase;
>>>>>>> 759f158b115fe27f7c61409d5f540d1effb6c0e1

import java.io.IOException;
import java.io.InputStream;
Solution content
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.R;

import java.io.IOException;
import java.io.InputStream;
File
LocParserTest.java
Developer's decision
None
Kind of conflict
Import