コード例 #1
0
 @Test(dataProvider = "addMapDataProvider", expectedExceptions = IllegalArgumentException.class)
 public void addMapFail(Map<String, String> map) {
   String[] columnsArr =
       Arrays.copyOf(map.keySet().toArray(), map.keySet().size(), String[].class);
   Table<String, String> sut = new Table<String, String>(String.class, columnsArr);
   map.put(UUID.randomUUID().toString(), UUID.randomUUID().toString());
   sut.add(map);
 }
コード例 #2
0
 @Test(dataProvider = "addMapDataProvider")
 public void addMap(Map<String, String> map) {
   String[] columnsArr =
       Arrays.copyOf(map.keySet().toArray(), map.keySet().size(), String[].class);
   Table<String, String> sut = new Table<String, String>(String.class, columnsArr);
   sut.add(map);
   Assert.assertEquals(sut.size(), 1, "Invalid table size");
   String[] rowAdded = sut.iterator().next();
   int colIdx = 0;
   for (String column : sut.getColumns()) {
     String cell = map.get(column);
     Assert.assertEquals(rowAdded[colIdx], cell, "Row value mismatch for column " + column);
     colIdx++;
   }
 }