group.addField( "filename" ); GroupDataBody groupData = new GroupDataBody(); ItemBand itemBand = new ItemBand();
/** * Done parsing. * * @throws org.xml.sax.SAXException * if there is a parsing error. */ protected void doneParsing() throws SAXException { for ( int i = 0; i < fieldHandlers.size(); i++ ) { final GroupFieldReadHandler readHandler = (GroupFieldReadHandler) fieldHandlers.get( i ); group.addField( (String) readHandler.getObject() ); } }
@Test( expected = NullPointerException.class ) public void testSetAddFieldException() { group.addField( null ); }
@Test public void testGetSortingConstraint() { group.addField( "field_value" ); List<SortConstraint> result = group.getSortingConstraint(); assertThat( result, is( notNullValue() ) ); assertThat( result.size(), is( equalTo( 1 ) ) ); assertThat( result.get( 0 ).getField(), is( equalTo( "field_value" ) ) ); } }
@Test public void testAddField() { group.addField( "test_field" ); assertThat( (String[]) group.getAttribute( AttributeNames.Core.NAMESPACE, AttributeNames.Core.GROUP_FIELDS ), is( equalTo( new String[] { "test_field" } ) ) ); }
@Test public void testEquals() { assertThat( group.equals( group ), is( equalTo( true ) ) ); assertThat( group.equals( mock( GroupDataBody.class ) ), is( equalTo( false ) ) ); RelationalGroup nextGroup = new RelationalGroup(); assertThat( group.equals( nextGroup ), is( equalTo( true ) ) ); nextGroup.addField( "test_field" ); assertThat( group.equals( nextGroup ), is( equalTo( false ) ) ); }
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 } }
final GroupDefinition groupDefinition = groups.get( i ); final RelationalGroup g = new RelationalGroup(); g.addField( groupDefinition.getGroupField() ); g.setName( computeGroupName( groupDefinition ) ); configureGroupHeader( groupDefinition, g, headerPrinted );