AbstractMongoRepository { public V create(final V value) { return create(value, mongoProperties.getDefaultWriteTimeout(), TimeUnit.MILLISECONDS); } AbstractMongoRepository(final MongoProperties mongoProperties); @PostConstruct void postConstruct(); Optional<V> findOne(final K key); Optional<V> findOne(final K key, final long maxTime, final TimeUnit timeUnit); Stream<V> findAllAsStream(); Stream<V> findAllAsStream(final long maxTime, final TimeUnit timeUnit); List<V> findAll(); List<V> findAll(final long maxTime, final TimeUnit timeUnit); Stream<V> findAllAsStream(final int skip, final int limit); Stream<V> findAllAsStream(final int skip, final int limit, final long maxTime, final TimeUnit timeUnit); List<V> findAll(final int skip, final int limit); List<V> findAll(final int skip, final int limit, final long maxTime, final TimeUnit timeUnit); V createOrUpdate(final V value); V createOrUpdate(final V value, final long maxTime, final TimeUnit timeUnit); void createOrUpdateBulk(final Collection<V> values); void createOrUpdateBulk(final Collection<V> values, final long maxTime, final TimeUnit timeUnit); V create(final V value); V create(final V value, final long maxTime, final TimeUnit timeUnit); boolean update(final V value); boolean update(final V value, final long maxTime, final TimeUnit timeUnit); UpdateIfMatchResult updateIfMatch(final V value, final String eTag); UpdateIfMatchResult updateIfMatch(final V value,
                                             final String eTag,
                                             final long maxTime,
                                             final TimeUnit timeUnit); long size(); long size(final long maxTime, final TimeUnit timeUnit); void delete(final K key); void delete(final K key, final long maxTime, final TimeUnit timeUnit); void deleteAll(); void deleteAll(final long maxTime, final TimeUnit timeUnit); static final String ID; static final String ETAG; }
@Test public void shouldNotCreateWithMissingId() { final TestObject testObject = new TestObject(null, "someValue"); assertThrows(NullPointerException.class, () -> { testee.create(testObject); }); }