VarNamePattern { public boolean isValid() { boolean valid = varNamePath_ != null; if( valid) { int i; for( i = 0; i < varNamePath_.length && DefUtils.isIdentifier( varNamePath_[i]); i++); int membersLeft = varNamePath_.length - i; valid = membersLeft == 0 || (membersLeft == 1 && (varNamePath_[i].equals( ALL_DESCENDANTS) || varNamePath_[i].equals( ALL_CHILDREN))); } return valid; } VarNamePattern( String pattern); boolean matches( String varName); boolean matches( VarNamePattern varName); boolean isValid(); boolean isApplicable( FunctionInputDef inputDef); boolean equals( Object object); int hashCode(); String toString();  }
@Test public void testIsValid_0() { VarNamePattern pattern = new VarNamePattern ( "1two.THREE4.5-6.seven_Eight.**"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( true)); }
@Test public void testIsValid_1() { VarNamePattern pattern = new VarNamePattern ( "var"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( true)); }
@Test public void testIsValid_2() { VarNamePattern pattern = new VarNamePattern ( "*"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( true)); }
@Test public void testIsValid_3() { VarNamePattern pattern = new VarNamePattern ( null); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_4() { VarNamePattern pattern = new VarNamePattern ( ""); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_5() { VarNamePattern pattern = new VarNamePattern ( " "); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_6() { VarNamePattern pattern; pattern = new VarNamePattern ( "first."); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "first..last"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "first.last."); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( ".first.last"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_7() { VarNamePattern pattern; pattern = new VarNamePattern ( " foo.bar"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "foo .bar"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "foo:bar"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "foo.bar "); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_8() { VarNamePattern pattern; pattern = new VarNamePattern ( "foo.*.bar.**"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "foo.**.bar.*"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_9() { VarNamePattern pattern; pattern = new VarNamePattern ( "*.foo.bar"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "**.foo"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }
@Test public void testIsValid_10() { VarNamePattern pattern; pattern = new VarNamePattern ( "foo.*.bar"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); pattern = new VarNamePattern ( "foo.bar.**.baz"); assertThat( "pattern=" + pattern + " valid", pattern.isValid(), is( false)); }