Example usage for java.time LocalDate of

List of usage examples for java.time LocalDate of

Introduction

In this page you can find the example usage for java.time LocalDate of.

Prototype

public static LocalDate of(int year, int month, int dayOfMonth) 

Source Link

Document

Obtains an instance of LocalDate from a year, month and day.

Usage

From source file:ch.rasc.edsutil.PropertyComparatorTest.java

@Before
public void setup() {
    users = new ArrayList<>();
    user1 = new User(1, "Ralph", LocalDate.of(1989, 1, 23), new BigDecimal("100.05"));
    users.add(user1);//from  www.ja v  a 2s. c o m
    user3 = new User(3, "Lamar", LocalDate.of(1989, 2, 15), new BigDecimal("100.15"));
    users.add(user3);
    user2 = new User(2, "jeremy", LocalDate.of(1989, 1, 22), new BigDecimal("100.25"));
    users.add(user2);
    user5 = new User(5, "Peter", LocalDate.of(1989, 12, 12), new BigDecimal("99.25"));
    users.add(user5);
    user4 = new User(4, "Branden", LocalDate.of(1989, 6, 7), new BigDecimal("99.15"));
    users.add(user4);
}

From source file:example.complete.DefaultCustomerManagementIntegrationTests.java

@Test
public void findsCustomerByLastame() {

    Customer customer = customerManagement.registerCustomer("Dave", "Matthews", LocalDate.of(1967, 1, 9));
    Collection<Customer> result = customerManagement.findByLastname("ma");

    assertThat(result, contains(customer));
}

From source file:org.bonitasoft.engine.bdm.serialization.BusinessDataObjectMapperTest.java

@Test
public void should_serialize_object_with_custom_local_date_and_time_serializers() throws Exception {
    // given:/*from   ww  w.j a  v  a 2 s .co  m*/
    Invoice invoice = new Invoice();
    invoice.setCustomerName("Bonitasoft");
    invoice.setDate(LocalDate.of(2018, 8, 15));
    invoice.setComments(null);

    // when:
    StringWriter writer = new StringWriter();
    objectMapper.writeValue(writer, invoice);

    // then:
    assertThatJson(writer.toString()).as("Serialization uses date and time custom serializers")
            .isEqualTo(getJsonContent("simpleInvoice.json"));
}

From source file:com.ewerk.prototype.persistence.repositories.PersonRepositoryCustomIntegTest.java

@BeforeTest
public void setup() {
    final LocalDate birthday = LocalDate.of(2000, Month.MARCH, 2);

    john = new Person();
    john.setLastName("Smith");
    john.setFirstName("John");
    john.setBirthday(birthday);//from  w  ww .  j  av a2s .  c  o  m
}

From source file:com.github.drbookings.LocalDates.java

public static Pair<LocalDate, LocalDate> getFirstAndLastDayOfMonth(final int month) {
    final int year = LocalDate.now().getYear();
    final LocalDate firstDay = LocalDate.of(year, month, 1);
    final LocalDate lastDay = getLastDayOfMonth(firstDay);
    return new ImmutablePair<>(firstDay, lastDay);
}

From source file:com.javiermoreno.springboot.mvc.users.UserManagementServiceImplIT.java

@Test
public void checkNewUserIsSavedAndContainsCorrectPasswordHash() {
    DailyUser user = new DailyUser();
    user.setEmail("alice@wonderland.com");
    user.setBirthday(/*from w  w w  .j av  a  2s.co  m*/
            Date.from(LocalDate.of(1976, Month.DECEMBER, 12).atStartOfDay(ZoneId.systemDefault()).toInstant()));
    service.registerNewUser(user, "secret", true);

    Assert.assertNotSame("Id correctly assigned", 0, user.getId());
    Assert.assertEquals("Password md5 is correctely encoded.", "5ebe2294ecd0e0f08eab7690d2a6ee69",
            user.getPassword());
}

From source file:com.create.batch.TicketReaderFactoryTest.java

@Test
public void testCreateReaderAndReadCorrectData() throws Exception {
    // given/*w w  w .  j a v  a  2 s .c  om*/
    final ExecutionContext executionContext = mock(ExecutionContext.class);
    final LocalDate date = LocalDate.of(2015, 12, 20);

    // when
    final ItemStreamReader<Ticket> reader = factory.createReader(new ClassPathResource("tickets.csv"));
    final Ticket ticket;

    try {
        reader.open(executionContext);
        ticket = reader.read();
    } finally {
        reader.close();
    }

    // then
    assertThat(ticket, notNullValue());
    assertThat(ticket.getTag(), equalTo("Ticket_0"));
    assertThat(ticket.getDate(), equalTo(Date.valueOf(date)));
    assertThat(ticket.getContent(), equalTo("Test ticket"));
}

From source file:me.yanaga.querydsl.args.core.single.SingleLocalDateArgumentTest.java

@BeforeMethod
public void setUp() {
    Person person = new Person();
    person.setOneLocalDate(LocalDate.of(2015, 2, 25));
    person.setAnotherLocalDate(LocalDate.of(2015, 2, 27));
    entityManager.persist(person);//w  w w.j  a va2s  .co  m
}

From source file:com.ewerk.prototype.api.PersonControllerIntegTest.java

@BeforeMethod
public void setup() {
    personRepository.deleteAll();//from  w w w  . j a va  2  s . co  m

    Person john = new Person();
    john.setLastName("Smith");
    john.setFirstName("John");
    john.setBirthday(LocalDate.of(2000, Month.DECEMBER, 10));
    personRepository.save(john);

    Person peggy = new Person();
    peggy.setLastName("Mullen");
    peggy.setFirstName("Peggy");
    peggy.setBirthday(LocalDate.of(1957, Month.APRIL, 16));
    personRepository.save(peggy);
}

From source file:me.yanaga.querydsl.args.core.single.SingleComparableArgumentTest.java

@BeforeMethod
public void setUp() {
    Person person = new Person();
    person.setOneCustomComparableType(CustomComparableType.of(LocalDate.of(2015, 2, 26)));
    person.setAnotherCustomComparableType(CustomComparableType.of(LocalDate.of(2015, 3, 23)));
    entityManager.persist(person);//from  w ww . j  a v  a2  s  .  c om
}