Skip to content

Commit

Permalink
validation fails with IllegalState instead of of NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
lbergelson committed Aug 1, 2019
1 parent 40036be commit 1cc3341
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,13 @@ private void filtersAsIs(final Set<String> filters) {
/**
* {@link #filters}
*
* @param filters Set of strings to set as the filters for this builder
* @param filters Strings to set as the filters for this builder
* @return this builder
*/
public VariantContextBuilder filters(final String ... filters) {
if(filters == null){
this.unfiltered();
}
filtersAsIs(new LinkedHashSet<>(Arrays.asList(filters)));
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ public void testCantCreateNullFilter(){
builder.filters((String)null);
builder.make();
}


@Test
public void testNullFilterArray(){
final VariantContextBuilder builder = new VariantContextBuilder("source", "contig", 1, 1, Arrays.asList(Tref, C, G)).filter("TEST");
builder.filters((String[])null);
}

@Test
public void testNullFilterSet(){
final VariantContextBuilder builder = new VariantContextBuilder("source", "contig", 1, 1, Arrays.asList(Tref, C, G)).filter("TEST");
builder.filters((Set<String>)null);
builder.make();
}


}

0 comments on commit 1cc3341

Please sign in to comment.