All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.javatool.protobuf.test.ProtobufDatesReaderTest.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.shared.protobuf.infrastructure.primary;

import static org.assertj.core.api.Assertions.*;

import com.google.protobuf.util.Timestamps;
import java.util.Date;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class ProtobufDatesReaderTest {

  @Test
  void shouldConvertNullTimestampToNull() {
    assertThat(ProtobufDatesReader.readInstant(null)).isNull();
  }

  @Test
  void shouldConvertDefaultDateToNull() {
    assertThat(ProtobufDatesReader.readInstant(Timestamps.fromDate(new Date(0)))).isNull();
  }

  @Test
  void shouldGetInstantFromTimestampFromDate() {
    Date date = new Date();

    assertThat(ProtobufDatesReader.readInstant(Timestamps.fromDate(date))).isEqualTo(date.toInstant());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy