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

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

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

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

import com.google.protobuf.Timestamp;
import java.time.Instant;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class ProtobufDatesWriterTest {

  @Test
  void shouldBuildNullTimestampFromNullInstant() {
    assertThat(ProtobufDatesWriter.buildTimestamp(null)).isNull();
  }

  @Test
  void shouldBuildTimestampFromInstant() {
    assertThat(ProtobufDatesWriter.buildTimestamp(Instant.ofEpochMilli(1337))).isEqualTo(
      Timestamp.newBuilder().setSeconds(1).setNanos(337000000).build()
    );
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy