@Override @CheckReturnValue public SELF as(String description, Object... args) { return super.as(description, args); }
@Override @CheckReturnValue public SELF as(Description description) { return super.as(description); }
@Override @CheckReturnValue public SELF as(String description, Object... args) { return super.as(description, args); }
@Override @CheckReturnValue public SELF as(Description description) { return super.as(description); }
protected void assertActualOwner(Task task, String expectedActualOwner) { User actualOwner = task.getTaskData().getActualOwner(); assertThat(actualOwner).as("No actual owner when expected").isNotNull(); assertThat(actualOwner.getId()).as("Not matching actual owner").isEqualTo(expectedActualOwner); }
protected void assertNoActualOwner(Task task) { assertThat(task.getTaskData().getActualOwner()).as("Actual owner present when not expected").isNull(); }
@Test(timeout = 15000) public void testTaskNotStartedReassign() throws Exception { Reader reader = new InputStreamReader(getClass().getResourceAsStream(MvelFilePath.DeadlineWithMultipleReassignment)); Map<String, Object> vars = new HashMap<String, Object>(); vars.put("now", new Date()); Task task = (InternalTask) TaskFactory.evalTask(reader, vars); Environment environment = EnvironmentFactory.newEnvironment(); Map<String, Object> inputVars = new HashMap<String, Object>(); inputVars.put("NotStartedReassign", "[users:Tony Stark,Bobba Fet,Jabba Hutt|groups:]@[2s]"); ((InternalTask) task).setDeadlines(HumanTaskHandlerHelper.setDeadlines(inputVars, Collections.emptyList(), environment)); taskService.addTask(task, inputVars); CountDownTaskEventListener countDownListener = new CountDownTaskEventListener(1, true, false); addCountDownListner(countDownListener); long taskId = task.getId(); String []owners = new String[] { "Tony Stark", "Bobba Fet", "Jabba Hutt" }; for(String owner : owners) { countDownListener.reset(1); taskService.claim(taskId, owner); task = taskService.getTaskById(taskId); assertThat(task.getTaskData().getActualOwner().getId()).isEqualTo(owner); countDownListener.waitTillCompleted(); task = taskService.getTaskById(taskId); assertThat(task.getTaskData().getActualOwner()).as("Task was not reclaimed").isNull(); } taskService.claim(taskId, "Bobba Fet"); taskService.start(taskId, "Bobba Fet"); taskService.complete(taskId, "Bobba Fet", Collections.<String, Object>emptyMap()); }
assertThat(task.getTaskData().getActualOwner()).as("Task was not reclaimed").isNull();
private void checkGetterReturnsValue(BoundStatement bs, TestTable table) { // Driver will not serialize null references in a statement. Object getterResult = getValue(bs, table.testColumnType); assertThat(getterResult) .as("Expected values to match for " + table.testColumnType) .isEqualTo(table.expectedPrimitiveValue); // Ensure that bs.getObject() also returns the expected value. assertThat(bs.getObject(0)) .as("Expected values to match for " + table.testColumnType) .isEqualTo(table.sampleValue); assertThat(bs.getObject("v")) .as("Expected values to match for " + table.testColumnType) .isEqualTo(table.sampleValue); }
@Test public void testXSDResourceNotBreakingCompilation() { final KieContainer kcontainer = KieServices.Factory.get().getKieClasspathContainer(); final KieBase kieBase = kcontainer.getKieBase("xsdKieBase"); Assertions.assertThat(kieBase).as("Created KieBase with XSD should not be null").isNotNull(); }
@Test(groups = "unit") public void parseNativeTest() { for (DataType dt : DataType.allPrimitiveTypes()) { if (exclude(dt)) continue; for (TestValue value : primitiveTestValues(dt)) assertThat(codecRegistry.codecFor(dt).parse(value.cqlInputString)) .as("Parsing input %s to a %s", value.cqlInputString, dt) .isEqualTo(value.javaObject); } }
public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).as("Person").isNotNull(); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); return new Object(); } });
public Object mapFromAttributes(Attributes attributes) throws NamingException { assertThat(attributes.get("sn").get()).as("Person").isNotNull(); assertThat(attributes.get("description").get()).isEqualTo("Sweden, Company1, Some Person"); return new Object(); } });
/** * Assert that the MicronodeResponse contains the given string field * @param name field name * @param value field value * @return fluent API */ public MicronodeResponseAssert hasStringField(String name, String value) { assertThat(actual.getFields().getStringField(name)).as("Field " + name).isNotNull(); assertThat(actual.getFields().getStringField(name).getString()).as("Field " + name + " value").isEqualTo(value); return this; } }
@Test public void testGetReadWriteContext_DirContext() { when(contextSourceMock.getReadWriteContext()).thenReturn(dirContextMock); DirContext result = tested.getReadWriteContext(); assertThat(result).as("Result should not be null").isNotNull(); assertThat(result instanceof DirContext).isTrue(); assertThat(result instanceof LdapContext).isFalse(); assertThat(result instanceof DirContextProxy).isTrue(); }
@Test public void testGetReadOnlyContext_LdapContext() { when(contextSourceMock.getReadWriteContext()).thenReturn(ldapContextMock); DirContext result = tested.getReadOnlyContext(); assertThat(result).as("Result should not be null").isNotNull(); assertThat(result instanceof LdapContext).isTrue(); assertThat(result instanceof DirContextProxy).isTrue(); } }
@Test(groups = "unit") public void parseNativeTest() { for (DataType dt : DataType.allPrimitiveTypes()) { if (exclude(dt)) continue; for (TestValue value : primitiveTestValues(dt)) assertThat(codecRegistry.codecFor(dt).parse(value.cqlInputString)) .as("Parsing input %s to a %s", value.cqlInputString, dt) .isEqualTo(value.javaObject); } }
@Test public void referencesAreNotByDefaultExpanded() { withCustomerInGroup(client(), (customer, customerGroup) -> { final CustomerByIdGet customerByIdGet = CustomerByIdGet.of(customer); final Customer loadedCustomer = client().executeBlocking(customerByIdGet); final Reference<CustomerGroup> customerGroupReference = loadedCustomer.getCustomerGroup(); assertThat(customerGroupReference.getId()).isEqualTo(customerGroup.getId()); assertThat(customerGroupReference.getObj()) .as("reference is not expanded") .isNull(); }); }
@Test public void demo() { final String key = randomKey(); final Foo foo = new Foo("bar", 7L); final CustomObject<Foo> customObject = client().executeBlocking(CustomObjectUpsertCommand .of(CustomObjectDraft.ofUnversionedUpsert(CONTAINER, key, foo, Foo.class))); final CustomObject<Foo> deletedObject = client().executeBlocking(CustomObjectDeleteCommand.of(CONTAINER, key, Foo.class)); assertThat(deletedObject.getValue()).isEqualTo(foo); assertThat(client().executeBlocking(CustomObjectByKeyGet.of(CONTAINER, key, Foo.class))) .as("get request") .isNull(); }