Polishing.

Tweak Javadoc.

Closes #614.
This commit is contained in:
Mark Paluch
2021-04-20 16:01:53 +02:00
parent 19b3c92192
commit 211d1440a2
5 changed files with 16 additions and 13 deletions

View File

@@ -18,9 +18,9 @@ package example.springdata.mongodb.unwrapping;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Simple Spring Boot application.
*
* @author Christoph Strobl
*/
@SpringBootApplication
public class ApplicationConfiguration {
}
public class ApplicationConfiguration {}

View File

@@ -18,6 +18,8 @@ package example.springdata.mongodb.unwrapping;
import java.util.Objects;
/**
* Value object capturing the {@code email} address.
*
* @author Christoph Strobl
*/
public class Email { // might as well be a record type in more recent java versions

View File

@@ -18,6 +18,8 @@ package example.springdata.mongodb.unwrapping;
import java.util.Objects;
/**
* Value object capturing the {@code username}.
*
* @author Christoph Strobl
*/
public class UserName { // might as well be a record type in more recent java versions

View File

@@ -23,14 +23,12 @@ import org.springframework.data.repository.CrudRepository;
public interface UserRepository extends CrudRepository<User, String> {
/**
* Use the value type directly.
* This will unwrap the values into the target query object.
* Use the value type directly. This will unwrap the values into the target query object.
*/
User findByUserName(UserName userName);
/**
* Use one of the unwrapped properties.
* This will drill into the unwrapped using the value for the target query.
* Use one of the unwrapped properties. This will drill into the unwrapped using the value for the target query.
*/
User findByEmailEmail(String email);
}

View File

@@ -19,21 +19,22 @@ import static org.assertj.core.api.Assertions.*;
import java.util.Arrays;
import com.mongodb.client.model.Filters;
import org.bson.Document;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import com.mongodb.client.model.Filters;
/**
* Integration tests showing unwrapped/embedded document usage.
*
* @author Christoph Strobl
*/
@SpringBootTest
@ExtendWith(SpringExtension.class)
@DataMongoTest
class UnwrappingIntegrationTests {
@Autowired UserRepository repository;