12/09/2018

[Java8] Supplier Functional Interface

From wikipedia

  • Manufacturer, uses tools and labour to make things for sale
    • Processor (manufacturing), converts a product from one form to another
  • Wholesaler, sells goods or merchandise to retailers
  • Merchant, a professional dealing with trade

From java definition

Represents a supplier of results. There is no requirement that a new or distinct result be returned each time the supplier is invoked.

Here are some test cases.
Gets a result.

   @Test
   public void testGetCurrentDate()
   {
      //when
      Supplier<LocalDateTime> dateTimeSupplier = () -> LocalDateTime.now();

      //verify
      Assertions.assertNotNull(dateTimeSupplier.get());
   }

No comments:

Post a Comment