Пример #1
0
 @Test
 public void testFuzzySearch() throws Exception {
   CertTypeService c = CertTypeService.getService();
   try {
     Assert.assertNotNull(c.fuzzySearch("id", "1"));
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Пример #2
0
  @Test
  public void testAddingBufferedImageUnderKeyAndRetrievingIt() {
    ImagesBuffer buffer = ImagesBuffer.getInstance();
    buffer.addEntry("all", "cards.jpg");
    BufferedImage image = buffer.getEntry("all");
    Assert.assertNotNull(image);
    // buffer.splitImagesFromSource("cards.jpg",50,100);
    // CardNode node= new CardNode(new Card(Card.Name.ACE,Card.Suit.SPADE));

  }
Пример #3
0
 /** Test predictions */
 @Test
 public void testPredict() {
   // get restaurant data
   DataSet restaurantData = null;
   try {
     restaurantData = DataSetTest.loadRestaurantData();
   } catch (IOException e) {
     Assert.fail("Could not load restaurant data from URL.");
   }
   // create tree
   DecisionTree t = new DecisionTree<String>(new Attribute<String>("Price", null));
   t.addBranch("$", new DecisionTreeLeaf("No"));
   t.addLeaf("$$", "Yes"); // alternate form, preferred
   t.addLeaf("$$$", "Maybe");
   // test
   Assert.assertEquals("No", t.predict(restaurantData.getExample(1)));
   Assert.assertEquals("Yes", t.predict(restaurantData.getExample(5)));
   Assert.assertEquals("Maybe", t.predict(restaurantData.getExample(0)));
   // test tree coverage
   for (Example e : restaurantData) {
     Assert.assertNotNull(t.predict(e));
   }
 }