@Test(groups = {"group1"}) public void service() { assertNotNull(null); } }
@Test public void canGet() { MaryConfig m = MaryConfig.getLanguageConfig(LUXEMBOURGISH); assertNotNull(m); assertTrue(((LanguageConfig) m).getLocales().contains(LUXEMBOURGISH)); }
private void assertRunOrPending(final Task<?> task) { assertFalse(task.isDone()); assertFalse(task.isFailed()); assertTrue(task.getShallowTrace().getStartNanos() > 0); assertNotNull(task.getShallowTrace().getEndNanos()); try { task.get(); fail("Should have thrown PromiseUnresolvedException"); } catch (PromiseUnresolvedException e) { // Expected case } try { task.getError(); fail("Should have thrown PromiseUnresolvedException"); } catch (PromiseUnresolvedException e) { // Expected case } }
private void verifyShallowTrace(final Task<?> task) { final ShallowTrace trace = findPossiblyFusedTrace(task); assertEquals(task.getName(), trace.getName()); assertEquals(ResultType.fromTask(task), trace.getResultType()); assertNull(trace.getEndNanos()); } else { assertTrue(trace.getEndNanos() <= System.nanoTime()); assertTrue(trace.getEndNanos() > trace.getStartNanos()); assertNotNull(trace.getValue()); } else { assertNull(trace.getValue()); assertNull(trace.getValue());
protected void assertSingleDummyTransportMessage(String name, String expectedBody) { List<Message> messages = dummyTransport.getMessages("dummy:" + name); assertNotNull("No messages recorded in dummy transport '" + name + "'", messages); if (messages.size() != 1) { fail("Invalid number of messages recorded in dummy transport '" + name + "', expected: 1, actual: "+messages.size()); } Message message = messages.get(0); assertEquals("Unexpected notifier "+name+" message body", expectedBody, message.getBody()); }
@Test public void testAssignmentExtensionContainerProperty() throws Exception { System.out.println("===[ testAssignmentExtensionContainerProperty ]==="); // GIVEN PrismContainer<AssignmentType> assignmentExtensionContainer = parseUserAssignmentContainer(); // WHEN PrismProperty<String> assignmentExtensionStringProperty = assignmentExtensionContainer.findOrCreateProperty(EXTENSION_STRING_TYPE_ELEMENT); // THEN assertNotNull("stringType is null", assignmentExtensionStringProperty); assertNotNull("stringType has no definition", assignmentExtensionStringProperty.getDefinition()); PrismAsserts.assertDefinition(assignmentExtensionStringProperty.getDefinition(), EXTENSION_STRING_TYPE_ELEMENT, DOMUtil.XSD_STRING, 0, -1); }
protected void assertNumberOfAttributes(PrismObject<ShadowType> shadow, Integer expectedNumberOfAttributes) { PrismContainer<Containerable> attributesContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES); assertNotNull("No attributes in repo shadow "+shadow, attributesContainer); List<Item<?,?>> attributes = attributesContainer.getValue().getItems(); assertFalse("Empty attributes in repo shadow "+shadow, attributes.isEmpty()); if (expectedNumberOfAttributes != null) { assertEquals("Unexpected number of attributes in repo shadow "+shadow, (int)expectedNumberOfAttributes, attributes.size()); } }
private void assertFilterElement(String message, Element filterElement) { assertNotNull("No "+message+" filter", filterElement); System.out.println("Filter element "+message); System.out.println(DOMUtil.serializeDOMToString(filterElement)); if (namespaces) { assertEquals("Wrong " + message + " filter namespace", PrismConstants.NS_QUERY, filterElement.getNamespaceURI()); } assertEquals("Wrong "+message+" filter localName", "equal", filterElement.getLocalName()); }
private void assertFound(TaskQuery tq1, String desc) { LOGGER.trace("Executing query {}", desc); org.activiti.engine.task.Task task1 = tq1.singleResult(); System.out.println("Task for " + desc + ": " + task1); assertNotNull("No task for " + desc, task1); }
public static void assertAttributeNotNull(ShadowType repoShadow, QName name) { Collection<String> values = getAttributeValues(repoShadow, name); assertFalse("No values for "+name+" in "+repoShadow, values == null || values.isEmpty()); assertEquals(1, values.size()); assertNotNull(values.iterator().next()); }
private void checkTask(TaskType subtaskType, String subtaskName, String processName) { assertEquals("Unexpected fetch result in wf subtask: " + subtaskName, null, subtaskType.getFetchResult()); WfContextType wfc = subtaskType.getWorkflowContext(); assertNotNull("Missing workflow context in wf subtask: " + subtaskName, wfc); assertNotNull("No process ID in wf subtask: " + subtaskName, wfc.getProcessInstanceId()); assertEquals("Wrong process ID name in subtask: " + subtaskName, processName, wfc.getProcessInstanceName()); assertNotNull("Missing process start time in subtask: " + subtaskName, wfc.getStartTimestamp()); assertNull("Unexpected process end time in subtask: " + subtaskName, wfc.getEndTimestamp()); assertEquals("Wrong outcome", null, wfc.getOutcome()); //assertEquals("Wrong state", null, wfc.getState()); }
private void assertLdapHash(String hash) { System.out.println("HASH: "+hash); assertNotNull("Null hash", hash); assertTrue("Wrong hash prefix, expected {SSHA}, was "+hash, hash.startsWith("{SSHA}")); assertEquals("Wrong hash length", 46, hash.length()); } }
private void checkNoAssignmentConstruction(UserType jack, String attributeName) { assertEquals("jack's assignments", 1, jack.getAssignment().size()); AssignmentType assignmentType = jack.getAssignment().get(0); ConstructionType constructionType = assignmentType.getConstruction(); assertNotNull("construction is null", constructionType); for (ResourceAttributeDefinitionType attributeDefinitionType : constructionType.getAttribute()) { if (attributeDefinitionType.getRef().equivalent(new ItemPathType(ItemPath.create(new QName(attributeName))))) { fail("Construction attribute " + attributeName + " present, although it shouldn't"); } } }
@Test public void testAssignmentExtensionContainerItem() throws Exception { System.out.println("===[ testAssignmentExtensionContainerItem ]==="); // GIVEN PrismContainer<AssignmentType> assignmentExtensionContainer = parseUserAssignmentContainer(); // WHEN PrismProperty<String> assignmentExtensionStringProperty = assignmentExtensionContainer.findOrCreateItem( EXTENSION_STRING_TYPE_ELEMENT, PrismProperty.class); // THEN assertNotNull("stringType is null", assignmentExtensionStringProperty); assertNotNull("stringType has no definition", assignmentExtensionStringProperty.getDefinition()); PrismAsserts.assertDefinition(assignmentExtensionStringProperty.getDefinition(), EXTENSION_STRING_TYPE_ELEMENT, DOMUtil.XSD_STRING, 0, -1); }
protected void assertNumberOfAttributes(PrismObject<ShadowType> shadow, Integer expectedNumberOfAttributes) { PrismContainer<Containerable> attributesContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES); assertNotNull("No attributes in repo shadow "+shadow, attributesContainer); List<Item<?,?>> attributes = attributesContainer.getValue().getItems(); assertFalse("Empty attributes in repo shadow "+shadow, attributes.isEmpty()); if (expectedNumberOfAttributes != null) { assertEquals("Unexpected number of attributes in repo shadow "+shadow, (int)expectedNumberOfAttributes, attributes.size()); } }
@Test public void testSetNullProperties() throws Exception { AbstractUserService userService = getUserService(); userService.setUserProperties(PROJECT_NAME, 3, JsonHelper.jsonObject() .put("test", (String) null) .put("test1", (String) null)); User test = userService.getUser(CONTEXT, 3).join(); assertEquals(test.id, 3); assertNotNull(test.properties.get("created_at").asText()); }
public static void assertAttributeNotNull(String message, ShadowType repoShadow, QName name) { Collection<String> values = getAttributeValues(repoShadow, name); assertFalse("No values for "+name+" in "+repoShadow, values == null || values.isEmpty()); assertEquals(message, 1, values.size()); assertNotNull(message, values.iterator().next()); }
protected void assertAssignmentPath(AssignmentPath path, String... targetOids) { assertEquals("Wrong path size", targetOids.length, path.size()); for (int i = 0; i < targetOids.length; i++) { ObjectType target = path.getSegments().get(i).getTarget(); if (targetOids[i] == null) { assertNull("Target #" + (i+1) + " should be null; it is: " + target, target); } else { assertNotNull("Target #" + (i+1) + " should not be null", target); assertEquals("Wrong OID in target #" + (i+1), targetOids[i], target.getOid()); } } }
/** * Verifies the common assertions for the obtained Future object * * @param f, the future * @param expected, expected result after get * @throws Exception */ private void assertFutureResult(Future<?> f, Object expected) throws Exception { assertNotNull(f); assertFalse(f.isCancelled()); assertEquals(expected, f.get()); assertTrue(f.isDone()); }
private void assertCredentialsPolicy(PrismObject<UserType> user) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { OperationResult result = new OperationResult("assertCredentialsPolicy"); CredentialsPolicyType credentialsPolicy = modelInteractionService.getCredentialsPolicy(user, null, result); result.computeStatus(); TestUtil.assertSuccess(result); assertNotNull("No credentials policy for "+user, credentialsPolicy); SecurityQuestionsCredentialsPolicyType securityQuestions = credentialsPolicy.getSecurityQuestions(); assertEquals("Unexepected number of security questions for "+user, 2, securityQuestions.getQuestion().size()); }