コード例 #1
0
 public void setElementAt(final int index, final Element element) {
   switch (index) {
     case 0:
       setHeader((GroupHeader) element);
       break;
     case 1:
       setBody((GroupBody) element);
       break;
     case 2:
       setFooter((GroupFooter) element);
       break;
     default:
       throw new IndexOutOfBoundsException();
   }
 }
コード例 #2
0
  public void testMethods() {
    final RelationalGroup g = new RelationalGroup();

    try {
      g.setHeader(null);
      fail();
    } catch (NullPointerException npe) {
      // expected, ignored
    }
    try {
      g.setFooter(null);
      fail();
    } catch (NullPointerException npe) {
      // expected, ignored
    }
    try {
      g.addField(null);
      fail();
    } catch (NullPointerException npe) {
      // expected, ignored
    }
  }