TypeConversion { public static com.google.protobuf.Timestamp convertTimestamp(Date ts) { return com.google.protobuf.Timestamp.newBuilder().setSeconds(ts.getTime() / 1000).build(); }  static com.google.protobuf.Timestamp convertTimestamp(Date ts); static List<String> convertTagStringToList(String tags); static Map<String, String> convertJsonStringToMap(String jsonString); static Map<String, Enum> convertJsonStringToEnumMap(String jsonString); static String convertMapToJsonString(Map<String, String> map); static String convertEnumMapToJsonString(Map<String, Enum> map);  }
@Test public void convertTimeStampShouldCorrectlyConvertDateToProtobufTimestamp() { Date date = new Date(1000); Timestamp expected = Timestamp.newBuilder().setSeconds(1).build(); assertThat(TypeConversion.convertTimestamp(date), equalTo(expected)); }