@Test public void testFindElementsByType() { Element element = mock( Element.class ); ElementType type = mock( ElementType.class ); ElementMetaData meta = mock( ElementMetaData.class ); doReturn( meta ).when( type ).getMetaData(); doReturn( "test_name" ).when( meta ).getName(); doReturn( type ).when( element ).getElementType(); ReportElement[] elems = ReportStructureMatcher.findElementsByType( element, type ); assertThat( elems.length, is( equalTo( 1 ) ) ); assertThat( elems[0], is( equalTo( (ReportElement) element ) ) ); }
public static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ) { final MatcherContext context = new MatcherContext(); context.setMatchSubReportChilds( false ); final String name = type.getMetaData().getName(); return matchAll( context, section, new ElementMatcher( name ) ); }
ReportStructureMatcher { public static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ) { final MatcherContext context = new MatcherContext(); context.setMatchSubReportChilds( false ); final String name = type.getMetaData().getName(); return matchAll( context, section, new ElementMatcher( name ) ); } }
ReportStructureMatcher { public static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ) { final MatcherContext context = new MatcherContext(); context.setMatchSubReportChilds( false ); final String name = type.getMetaData().getName(); return matchAll( context, section, new ElementMatcher( name ) ); }  }
ReportStructureMatcher { public static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ) { final MatcherContext context = new MatcherContext(); context.setMatchSubReportChilds( false ); final String name = type.getMetaData().getName(); return matchAll( context, section, new ElementMatcher( name ) ); }  static NodeMatcher parse( final String s ); static ReportElement match( final MatcherContext context, final ReportElement base, final NodeMatcher parse ); static ReportElement[] matchAll( final MatcherContext context, final ReportElement base,
      final NodeMatcher parse ); static ReportElement match( final MatcherContext context, final ReportElement base, final String selector ); static ReportElement[] matchAll( final MatcherContext context, final ReportElement base, final String selector ); static ReportElement[] findElementsByName( final ReportElement section, final String name ); static ReportElement[] findElementsByAttribute( final ReportElement section, final String ns, final String name ); static ReportElement[] findElementsByAttribute( final ReportElement section, final String ns,
      final String name, final Object value ); static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ); static ReportElement findElementByType( final Element element, final ElementType type ); }
ReportStructureMatcher { public static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ) { final MatcherContext context = new MatcherContext(); context.setMatchSubReportChilds( false ); final String name = type.getMetaData().getName(); return matchAll( context, section, new ElementMatcher( name ) ); }  static NodeMatcher parse( final String s ); static ReportElement match( final MatcherContext context, final ReportElement base, final NodeMatcher parse ); static ReportElement[] matchAll( final MatcherContext context, final ReportElement base,
      final NodeMatcher parse ); static ReportElement match( final MatcherContext context, final ReportElement base, final String selector ); static ReportElement[] matchAll( final MatcherContext context, final ReportElement base, final String selector ); static ReportElement[] findElementsByName( final ReportElement section, final String name ); static ReportElement[] findElementsByAttribute( final ReportElement section, final String ns, final String name ); static ReportElement[] findElementsByAttribute( final ReportElement section, final String ns,
      final String name, final Object value ); static ReportElement[] findElementsByType( final ReportElement section, final ElementType type ); static ReportElement findElementByType( final Element element, final ElementType type );  }