SurvexExporter extends SingleFileExporter { public String getContent(Survey survey) { StringBuilder builder = new StringBuilder(); builder.append("*alias station - ..\n\n"); List<GraphToListTranslator.SurveyListEntry> list = graphToListTranslator.toChronoListOfSurveyListEntries(survey); for (GraphToListTranslator.SurveyListEntry entry : list) { SurvexTherionUtil.formatEntry(builder, entry, COMMENT_CHAR); builder.append("\n"); } return builder.toString(); }  String getContent(Survey survey); @Override String getFileExtension(); @Override String getExportTypeName(Context context); @Override String getExportDirectoryName(); static final char COMMENT_CHAR; }
@Test public void testBasicExport() { SurvexExporter survexExporter = new SurvexExporter(); Survey oneNorth = BasicTestSurveyCreator.createStraightNorth(); String content = survexExporter.getContent(oneNorth); Assert.assertTrue(content.contains("1\t2\t5.000\t0.00\t0.00")); Assert.assertTrue(content.contains("2\t3\t5.000\t0.00\t0.00")); Assert.assertTrue(content.contains("3\t4\t5.000\t0.00\t0.00")); }
@Test public void testBasicExportWithPromotedLegs() { SurvexExporter survexExporter = new SurvexExporter(); Survey oneNorth = BasicTestSurveyCreator.createStraightNorthThroughRepeats(); String content = survexExporter.getContent(oneNorth); Assert.assertTrue(content.contains("1\t2\t5.000\t0.00\t0.00")); Assert.assertTrue(content.contains( "{from: 5.000 0.00 0.00, 5.000 0.00 0.00, 5.000 0.00 0.00}")); }
@Test public void testCommentsAreIncluded() { SurvexExporter survexExporter = new SurvexExporter(); Survey oneNorth = BasicTestSurveyCreator.createStraightNorthThroughRepeats(); Station latest = oneNorth.getActiveStation(); String testComment = "Comment McComment Face"; latest.setComment(testComment); String content = survexExporter.getContent(oneNorth); Assert.assertTrue(content.contains(testComment)); }