Files
JIMRI/java/test/jmri/jmrit/symbolicprog/QuantumCvMgrImporterTest.java
T
2026-06-17 14:00:51 +02:00

63 lines
1.8 KiB
Java

package jmri.jmrit.symbolicprog;
import org.junit.Assert;
import org.junit.jupiter.api.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import jmri.util.FileUtil;
import javax.swing.JLabel;
/**
*
* @author Paul Bender Copyright (C) 2017
*/
public class QuantumCvMgrImporterTest {
public File makeTempFile(String contents) throws IOException {
// create a file
FileUtil.createDirectory(FileUtil.getUserFilesPath() + "temp");
File f = new java.io.File(FileUtil.getUserFilesPath() + "temp" + File.separator + "CsvImporter.test.xml");
// recreate it
if (f.exists()) {
Assertions.assertTrue(f.delete());
}
try (PrintStream p = new PrintStream(new FileOutputStream(f))) {
p.print(contents);
}
return f;
}
@Test
public void testCTor() throws IOException {
// create a file
String s = "CV1=0\n"
+ "CV2=1\n";
File f = makeTempFile(s);
CvTableModel tm = new CvTableModel(new JLabel(), null);
QuantumCvMgrImporter t = new QuantumCvMgrImporter(f,tm);
Assert.assertNotNull("exists",t);
jmri.util.JUnitAppender.assertWarnMessage("Adding CV 1 description \"\", which was in import file but not defined by the decoder definition");
jmri.util.JUnitAppender.assertWarnMessage("Adding CV 2 description \"\", which was in import file but not defined by the decoder definition");
}
@BeforeEach
public void setUp() {
jmri.util.JUnitUtil.setUp();
}
@AfterEach
public void tearDown() {
jmri.util.JUnitUtil.tearDown();
}
// private static final Logger log = LoggerFactory.getLogger(QuantumCvMgrImporterTest.class);
}