コード例 #1
0
 public void testMatchingDecoderList() {
   // setup the test object with guts
   DecoderIndexFile di = new DecoderIndexFile();
   setupDoc();
   // invoke parsing
   di.readMfgSection(decoderIndexElement);
   di.readFamilySection(decoderIndexElement);
   // search for the two Digitrax decoders
   List<DecoderFile> l1 = di.matchingDecoderList("Digitrax", null, null, null, null, null);
   Assert.assertEquals("Found with name Digitrax ", 3, l1.size());
   Assert.assertEquals("Found with name Digitrax ", "DH142", (l1.get(1)).getModel());
   Assert.assertEquals("Found with name Digitrax ", "DN142", (l1.get(2)).getModel());
   // search for the two decoders from mfgID 129
   List<DecoderFile> l2 = di.matchingDecoderList(null, null, "129", null, null, null);
   Assert.assertEquals("Found with id 129 ", 3, l2.size());
   // search for the two from the NMRA family
   List<DecoderFile> l4 =
       di.matchingDecoderList(null, "NMRA S&RP definitions", null, null, null, null);
   Assert.assertEquals("Found from NMRA family ", 3, l4.size());
   // search for the one with version ID 21
   List<DecoderFile> l3 = di.matchingDecoderList(null, null, null, "21", null, null);
   Assert.assertEquals("Found with version 21 ", 1, l3.size());
 }
コード例 #2
0
 public void testMatchingVersionRange() {
   // setup the test object with guts
   DecoderIndexFile di = new DecoderIndexFile();
   setupDoc();
   // invoke parsing
   di.readMfgSection(decoderIndexElement);
   di.readFamilySection(decoderIndexElement);
   // search for the one with various version IDs
   List<DecoderFile> l3;
   l3 = di.matchingDecoderList(null, null, null, "20", null, null);
   Assert.assertEquals("Found with version 20 ", 0, l3.size());
   l3 = di.matchingDecoderList(null, null, null, "21", null, null);
   Assert.assertEquals("Found with version 21 ", 1, l3.size());
   l3 = di.matchingDecoderList(null, null, null, "22", null, null);
   Assert.assertEquals("Found with version 22 ", 1, l3.size());
   l3 = di.matchingDecoderList(null, null, null, "23", null, null);
   Assert.assertEquals("Found with version 23 ", 1, l3.size());
   l3 = di.matchingDecoderList(null, null, null, "24", null, null);
   Assert.assertEquals("Found with version 24 ", 1, l3.size());
   l3 = di.matchingDecoderList(null, null, null, "25", null, null);
   Assert.assertEquals("Found with version 25 ", 0, l3.size());
 }