@Override public void serialize(ObjectId objectId, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeString(objectId.toString()); } }
public String convert(ObjectId id) { return id == null ? null : id.toString(); } }
@Override public void serialize(ObjectId objectId, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { jsonGenerator.writeString(objectId.toString()); }
public BigInteger convert(ObjectId source) { return source == null ? null : new BigInteger(source.toString(), 16); } }
@Override public String toString() { return this.id.toString() + ": \"" + this.getTitle() + "\""; }
/** * Returns {@link #fromString(String) parsable} representation of Id. * @return hexadecimal formatted string. */ @Override public String toString() { return new ObjectId(data).toString(); } }
@Override public String getId() { return id.toString(); } }
String getId() { return id.toString(); } }
public String getId() { return id.toString(); }
@Test(expected = NumberFormatException.class) public void testSaveNotificationWithIncorrectIds() { NotificationDto notification = new NotificationDto(); notification.setSchemaId(new ObjectId().toString()); notification.setTopicId(new ObjectId().toString()); notificationService.saveNotification(notification); } }
@Test(expected = IncorrectParameterException.class) public void testSaveNotificationSchemaWithEmptyType() { NotificationSchemaDto schema = new NotificationSchemaDto(); schema.setApplicationId(new ObjectId().toString()); notificationService.saveNotificationSchema(schema); }
assertThat(key.get("id")).isEqualTo(objId.toString());
assertThat(key.get("id")).isEqualTo(objId.toString());
assertThat(key.get("id")).isEqualTo(objId.toString());
@Test public void setWithOtherOperations() throws Exception { String id = "i1"; ImmutableItem item = ImmutableItem.builder().id(id).addList("l1").build(); check(repository.upsert(item).getUnchecked()).is(1); repository.update(repository.criteria().id(id)) .setTags(Collections.singleton(ImmutableTag.of("t1"))) .setList(Collections.singleton("l1")) .setIds(Collections.singleton(Id.fromString(new ObjectId().toString()))) .updateFirst() .getUnchecked(); Item item2 = findById(id); check(item2.list()).hasAll("l1"); check(item2.tags()).hasAll(ImmutableTag.of("t1")); check(item2.ids()).hasSize(1); }
assertThat(key.get("id")).isEqualTo(objId.toString());