| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package footleg.cavesurvey.converter; |
| 20 |
|
| 21 |
import static org.junit.Assert.*; |
| 22 |
|
| 23 |
import org.junit.Test; |
| 24 |
|
| 25 |
import footleg.cavesurvey.converter.CaveConverter.SurveyDataInputFormats; |
| 26 |
import footleg.cavesurvey.converter.CaveConverter.SurveyDataOutputFormats; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public class CaveConverterTest { |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
@Test |
| 41 |
public void testGetFormatNameSurveyDataInputFormats() { |
| 42 |
String testCompassDisplayName = CaveConverter.getFormatName( SurveyDataInputFormats.Compass ); |
| 43 |
assertEquals("Test correct display name is returned for format", "Compass", testCompassDisplayName); |
| 44 |
|
| 45 |
String testDXFDisplayName = CaveConverter.getFormatName( SurveyDataInputFormats.DXF ); |
| 46 |
assertEquals("Test correct display name is returned for format", "DXF", testDXFDisplayName); |
| 47 |
|
| 48 |
String testPocketTopoDisplayName = CaveConverter.getFormatName( SurveyDataInputFormats.PocketTopo ); |
| 49 |
assertEquals("Test correct display name is returned for format", "PocketTopo", testPocketTopoDisplayName); |
| 50 |
|
| 51 |
String testSurvexDisplayName = CaveConverter.getFormatName( SurveyDataInputFormats.Survex ); |
| 52 |
assertEquals("Test correct display name is returned for format", "Survex", testSurvexDisplayName); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
@Test |
| 59 |
public void testGetFormatNameSurveyDataOutputFormats() { |
| 60 |
String testSurvexDisplayName = CaveConverter.getFormatName( SurveyDataOutputFormats.Survex ); |
| 61 |
assertEquals("Test correct display name is returned for format", "Survex", testSurvexDisplayName); |
| 62 |
|
| 63 |
String testToporobotDisplayName = CaveConverter.getFormatName( SurveyDataOutputFormats.Toporobot ); |
| 64 |
assertEquals("Test correct display name is returned for format", "Toporobot", testToporobotDisplayName); |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
@Test |
| 71 |
public void testInputFormatFromFileExtn() { |
| 72 |
|
| 73 |
SurveyDataInputFormats testCompassL = CaveConverter.inputFormatFromFileExtn( "dat" ); |
| 74 |
assertEquals("Test correct format is returned for Compass DAT file (lowercase extn)", SurveyDataInputFormats.Compass, testCompassL); |
| 75 |
|
| 76 |
SurveyDataInputFormats testCompassU = CaveConverter.inputFormatFromFileExtn( "DAT" ); |
| 77 |
assertEquals("Test correct format is returned for Compass DAT file (uppercase extn)", SurveyDataInputFormats.Compass, testCompassU); |
| 78 |
|
| 79 |
SurveyDataInputFormats testCompassM = CaveConverter.inputFormatFromFileExtn( "dAt" ); |
| 80 |
assertEquals("Test correct format is returned for Compass DAT file (mixedcase extn)", SurveyDataInputFormats.Compass, testCompassM); |
| 81 |
|
| 82 |
|
| 83 |
SurveyDataInputFormats testDXFL = CaveConverter.inputFormatFromFileExtn( "dxf" ); |
| 84 |
assertEquals("Test correct format is returned for DXF DAT file (lowercase extn)", SurveyDataInputFormats.DXF, testDXFL); |
| 85 |
|
| 86 |
SurveyDataInputFormats testDXFU = CaveConverter.inputFormatFromFileExtn( "DXF" ); |
| 87 |
assertEquals("Test correct format is returned for DXF DAT file (uppercase extn)", SurveyDataInputFormats.DXF, testDXFU); |
| 88 |
|
| 89 |
SurveyDataInputFormats testDXFM = CaveConverter.inputFormatFromFileExtn( "dXf" ); |
| 90 |
assertEquals("Test correct format is returned for DXF DAT file (mixedcase extn)", SurveyDataInputFormats.DXF, testDXFM); |
| 91 |
|
| 92 |
|
| 93 |
SurveyDataInputFormats testPocketTopoL = CaveConverter.inputFormatFromFileExtn( "txt" ); |
| 94 |
assertEquals("Test correct format is returned for PocketTopo DAT file (lowercase extn)", SurveyDataInputFormats.PocketTopo, testPocketTopoL); |
| 95 |
|
| 96 |
SurveyDataInputFormats testPocketTopoU = CaveConverter.inputFormatFromFileExtn( "TXT" ); |
| 97 |
assertEquals("Test correct format is returned for PocketTopo DAT file (uppercase extn)", SurveyDataInputFormats.PocketTopo, testPocketTopoU); |
| 98 |
|
| 99 |
SurveyDataInputFormats testPocketTopoM = CaveConverter.inputFormatFromFileExtn( "tXt" ); |
| 100 |
assertEquals("Test correct format is returned for PocketTopo DAT file (mixedcase extn)", SurveyDataInputFormats.PocketTopo, testPocketTopoM); |
| 101 |
|
| 102 |
|
| 103 |
SurveyDataInputFormats testSurvexL = CaveConverter.inputFormatFromFileExtn( "svx" ); |
| 104 |
assertEquals("Test correct format is returned for Survex DAT file (lowercase extn)", SurveyDataInputFormats.Survex, testSurvexL); |
| 105 |
|
| 106 |
SurveyDataInputFormats testSurvexU = CaveConverter.inputFormatFromFileExtn( "SVX" ); |
| 107 |
assertEquals("Test correct format is returned for Survex DAT file (uppercase extn)", SurveyDataInputFormats.Survex, testSurvexU); |
| 108 |
|
| 109 |
SurveyDataInputFormats testSurvexM = CaveConverter.inputFormatFromFileExtn( "sVx" ); |
| 110 |
assertEquals("Test correct format is returned for Survex DAT file (mixedcase extn)", SurveyDataInputFormats.Survex, testSurvexM); |
| 111 |
|
| 112 |
|
| 113 |
SurveyDataInputFormats testUnknown = CaveConverter.inputFormatFromFileExtn( "xml" ); |
| 114 |
assertEquals("Test null returned for unsupported file extn", null, testUnknown); |
| 115 |
} |
| 116 |
|
| 117 |
} |