### Question:
StreamPredicateBuilder implements Predicate, StreamPredicate { public StreamPredicateBuilder or(Predicate predicate) throws IllegalStateException { if (predicate != StreamPredicateBuilder.this) { throw new IllegalStateException( "Illegal \"or\" statement expected: " + StreamPredicateBuilder.class.getSimpleName() + ", found: " + ((Objects.isNull(predicate)) ? "null" : predicate.getClass().getSimpleName())); } int index = predicateList.size() - 2; StreamPredicate first = predicateList.remove(index); StreamPredicate second = predicateList.remove(index); predicateList.add(StreamPredicates.or(first, second)); return this; } StreamPredicateBuilder(); Attribute.Name getAttribute(); void setAttribute(Attribute.Name attributeName); @Override boolean apply(Collection<Attribute> attributes); StreamComparison getComparison(); StreamPredicateBuilder and(StreamPredicate predicate); StreamPredicateBuilder or(Predicate predicate); @Override Comparison attribute(Attribute.Name name); @Override Predicate and(Predicate... predicates); @Override Predicate or(Predicate... predicates);  }### Answer:
@Test public void testStreamPredicateBuilderOrWithMultiPredicate() { StreamPredicateBuilder spb = new StreamPredicateBuilder(); try{ spb.or(null, null); fail("should throw unsupported operation exception"); }catch(Exception e){ assertTrue(e instanceof UnsupportedOperationException); } }
@Test public void testOrWithDiffPredicateInstance(){ StreamPredicateBuilder spb = new StreamPredicateBuilder(); StreamPredicateBuilder spb2 = new StreamPredicateBuilder(); try{ spb.or(spb2); fail("should throw"); }catch(Exception e){ assertTrue(e instanceof IllegalStateException); } }
@Test public void testOrWithNullPredicateInstance(){ StreamPredicateBuilder spb = new StreamPredicateBuilder(); StreamPredicateBuilder spb2 = null; try{ spb.or(spb2); fail("should throw"); }catch(Exception e){ assertTrue(e instanceof IllegalStateException); } }