@Test(expected = OseeArgumentException.class) public void testBadSearchMethod() throws OseeCoreException { IdsPredicateHandler handler = new IdsPredicateHandler(); String id1 = "12345"; List<String> values = Collections.singletonList(id1); Predicate testPredicate = new Predicate(SearchMethod.ATTRIBUTE_TYPE, null, null, null, null, values); handler.handle(builder, testPredicate); }
@Test(expected = OseeArgumentException.class) public void testHandleNonId() throws OseeCoreException { IdsPredicateHandler handler = new IdsPredicateHandler(); // no type params, op, or flags for ids - any passed are ignored // all digits get treated as artId String id1 = GUID.create(); List<String> values = Collections.singletonList(id1); Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null, null, null, values); handler.handle(builder, testPredicate); }
@Test public void testHandleLocalId() throws OseeCoreException { IdsPredicateHandler handler = new IdsPredicateHandler(); // no type params, op, or flags for ids - any passed are ignored // all digits get treated as artId String id1 = "12345"; List<String> values = Collections.singletonList(id1); Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null, null, null, values); handler.handle(builder, testPredicate); verify(builder).andLocalIds(localIdsCaptor.capture()); Assert.assertEquals(1, localIdsCaptor.getValue().size()); Assert.assertTrue(localIdsCaptor.getValue().contains(12345)); }
@Test(expected = OseeArgumentException.class) public void testHandleBadValues() throws OseeCoreException { IdsPredicateHandler handler = new IdsPredicateHandler(); Predicate testPredicate = new Predicate(SearchMethod.IDS, null, null, null, null, null); handler.handle(builder, testPredicate); }