@Test //https://github.com/reactor/reactor-core/issues/1326 public void toArrayOnZeroQueueShouldNotFailAlsoOnJava9() { Queue<Integer> emptyQueue = Queues.<Integer>empty().get(); assertThat(emptyQueue.toArray(new Integer[0])).as("toArray(empty)").isEmpty(); }
String extractedDescription = extractedDescriptionOf(propertiesOrFields); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(result).as(description);
@Test public void zeroQueueOperations() { Queue<Integer> q = Queues.<Integer>empty().get(); List<Integer> vals = Arrays.asList(1, 2, 3); assertThat(q.add(1)).as("add").isFalse(); assertThat(q.addAll(vals)).as("addAll").isFalse(); assertThat(q.offer(1)).as("offer").isFalse(); assertThat(q.peek()).as("peek").isNull(); assertThat(q.poll()).as("poll").isNull(); assertThat(q.contains(1)).as("contains").isFalse(); assertThat(q.iterator()).as("iterator").isEmpty(); assertThatExceptionOfType(NoSuchElementException.class) .as("element") .isThrownBy(q::element); assertThatExceptionOfType(NoSuchElementException.class) .as("remove") .isThrownBy(q::remove); assertThat(q.remove(1)).as("remove").isFalse(); assertThat(q.containsAll(vals)).as("containsAll").isFalse(); assertThat(q.retainAll(vals)).as("retainAll").isFalse(); assertThat(q.removeAll(vals)).as("removeAll").isFalse(); assertThatCode(q::clear).as("clear").doesNotThrowAnyException(); assertThat(q) .hasSize(0) .isEmpty(); assertThat(q.toArray()).as("toArray").isEmpty(); assertThat(q.toArray(new Integer[0])).as("toArray(empty)").isEmpty(); Integer[] array = new Integer[]{-1, -2, -3}; assertThat(q.toArray(array)).as("toArray(pre-filled)").containsExactly(null, -2, -3); }
String extractedDescription = extractedDescriptionOf(propertiesOrFields); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(result).as(description);
String extractedDescription = extractedDescriptionOf(fieldOrProperty); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOfMethod(method); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOfMethod(method); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOf(fieldOrProperty); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOf(fieldOrProperty); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOf(fieldOrProperty); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOfMethod(method); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
String extractedDescription = extractedDescriptionOfMethod(method); String description = mostRelevantDescription(info.description(), extractedDescription); return new ObjectArrayAssert<>(values).as(description);
/** * Asserts that the tabs of the given {@code JTabbedPane} have the given titles. The tab titles are evaluated by index * order, for example, the first tab is expected to have the first title in the given array, and so on. * * @param tabbedPane the target {@code JTabbedPane}. * @param titles the expected titles. * @throws AssertionError if the title of any of the tabs is not equal to the expected titles. */ @RunsInEDT public void requireTabTitles(@Nonnull JTabbedPane tabbedPane, @Nonnull String[] titles) { String[] actualTitles = allTabTitlesIn(tabbedPane); assertThat(actualTitles).as(propertyName(tabbedPane, "tabTitles")).isEqualTo(titles); }
/** * Asserts that the {@code JOptionPane} has the given options. * * @param optionPane the target {@code JOptionPane}. * @param options the options to verify. * @throws AssertionError if the {@code JOptionPane} does not have the given options. */ @RunsInEDT public void requireOptions(@Nonnull JOptionPane optionPane, @Nonnull Object[] options) { assertThat(optionsOf(optionPane)).as(propertyName(optionPane, OPTIONS_PROPERTY)).isEqualTo(options); }
/** * Obtain the beans names of the given type from the application context, the names * becoming the object array under test. * <p> * Example: <pre class="code"> * assertThat(context).getBeanNames(Foo.class).containsOnly("fooBean"); </pre> * @param <T> the bean type * @param type the bean type * @return array assertions for the bean names * @throws AssertionError if the application context did not start */ public <T> AbstractObjectArrayAssert<?, String> getBeanNames(Class<T> type) { if (this.startupFailure != null) { throwAssertionError(contextFailedToStartWhenExpecting( "to get beans names with type:%n <%s>", type)); } return Assertions.assertThat(getApplicationContext().getBeanNamesForType(type)) .as("Bean names of type <%s> from <%s>", type, getApplicationContext()); }
.as("The scheme `%s` was resolved from a unexpected artifact", scheme).isEqualTo(coordinates);
@Ignore @Test public void testEmptyMessageReceivedHeader() throws Exception { init(smtpConfiguration); SMTPClient smtp = newSMTPClient(); // no message there, yet assertThat(queue.getLastMail()) .as("no mail received by mail server") .isNull();; smtp.helo(InetAddress.getLocalHost().toString()); smtp.setSender("mail@localhost"); smtp.addRecipient("mail@localhost"); smtp.sendShortMessageData(""); smtp.quit(); smtp.disconnect(); assertThat(queue.getLastMail().getMessage().getHeader("Received")) .as("spooled mail has Received header") .isNotNull(); // TODO: test body size }
@Test public void testReceivedHeader() throws Exception { init(smtpConfiguration); SMTPClient smtp = newSMTPClient(); // no message there, yet assertThat(queue.getLastMail()) .as("no mail received by mail server") .isNull();; smtp.helo(InetAddress.getLocalHost().toString()); smtp.setSender("mail@localhost"); smtp.addRecipient("mail@localhost"); smtp.sendShortMessageData("Subject: test\r\n\r\n"); smtp.quit(); smtp.disconnect(); assertThat(queue.getLastMail().getMessage().getHeader("Received")) .as("spooled mail has Received header") .isNotNull(); }