/*******************************************************************************
 * Debrief - the Open Source Maritime Analysis Application
 * http://debrief.info
 *
 * (C) 2000-2020, Deep Blue C Technology Ltd
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html)
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *******************************************************************************/
package Debrief.ReaderWriter.Nisida;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import Debrief.Wrappers.TrackWrapper;
import MWC.GUI.Layer;
import MWC.GUI.Layers;
import junit.framework.TestCase;

public class ImportNisidaTest extends TestCase {
	private final String nisida_track = "../org.mwc.cmap.combined.feature/root_installs/sample_data/other_formats/nisida_sample.txt";
	private final String not_nisida_track = "../org.mwc.cmap.combined.feature/root_installs/sample_data/other_formats/CLOG_Trial_sample.txt";

	public void testCanLoad() throws FileNotFoundException {
		ImportNisida importer = new ImportNisida();
		assertTrue(importer.canLoadThisFile(new FileInputStream(nisida_track)));
		assertFalse(importer.canLoadThisFile(new FileInputStream(not_nisida_track)));
	}
	
	public void testLoad() throws FileNotFoundException {
		ImportNisida importer = new ImportNisida();
		FileInputStream fis = new FileInputStream(nisida_track);
		final Layers layers = new Layers();
		importer.importThis(fis, layers);
		
		assertEquals("created layers", 4, layers.size());
		Layer ownshipLayer = layers.findLayer("ADRI");
		assertNotNull("created O/S track", ownshipLayer);
		assertTrue("is track wrapper", ownshipLayer instanceof TrackWrapper);
		TrackWrapper ownship = (TrackWrapper) ownshipLayer;
		assertEquals("correct number of points", 4, ownship.numFixes());
	}
}

@@ -1188,30 +1188,23 @@
 OG_Trial
-_sample
 .txt%22;%0A
+
 %0A%09public
@@ -1248,32 +1248,43 @@
 ndException %7B%0A%09%09
+assertTrue(
 ImportNisida imp
@@ -1283,61 +1283,8 @@
 sida
- importer = new ImportNisida();%0A%09%09assertTrue(importer
 .can
@@ -1347,24 +1347,28 @@
 rtFalse(
-i
+I
 mport
-er
+Nisida
 .canLoad
@@ -1481,54 +1481,8 @@
 n %7B%0A
-%09%09ImportNisida importer = new ImportNisida();%0A
 %09%09Fi
@@ -1580,16 +1580,20 @@
 ;%0A%09%09
-i
+I
 mport
-er
+Nisida
 .imp

inject some previous text