@Test public void test_whenSetPredicatesOnNewInstance() throws IllegalAccessException, InstantiationException { CompoundPredicate o = klass.newInstance(); Predicate truePredicate = new TruePredicate(); o.setPredicates(new Predicate[] {truePredicate}); assertEquals(truePredicate, o.getPredicates()[0]); }
@Test(expected = IllegalStateException.class) public void test_whenSetPredicatesOnExistingPredicates_thenThrowException() throws IllegalAccessException, InstantiationException { CompoundPredicate o = klass.newInstance(); Predicate truePredicate = new TruePredicate(); o.setPredicates(new Predicate[] {truePredicate}); Predicate falsePredicate = new FalsePredicate(); o.setPredicates(new Predicate[] {falsePredicate}); fail(); }