Skip to content

Commit 606700b

Browse files
Rename getPart() to getPartState() to reflect the nature of the call
1 parent 51fc738 commit 606700b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

server/src/main/java/org/spine3/server/aggregate/AggregateRoot.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected BoundedContext getBoundedContext() {
8282
* @param <S> the type of the part state
8383
* @return the state of the part or a default state if the state was not found
8484
*/
85-
protected <S extends Message, A extends AggregatePart<I, S, ?>> S getPart(Class<S> partStateClass) {
85+
protected <S extends Message, A extends AggregatePart<I, S, ?>> S getPartState(Class<S> partStateClass) {
8686
final AggregatePartRepository<I, A> repo = getRepository(partStateClass);
8787
final AggregatePart<I, S, ?> aggregatePart = repo.loadOrCreate(getId());
8888
final S partState = aggregatePart.getState();
@@ -92,8 +92,9 @@ protected BoundedContext getBoundedContext() {
9292
/**
9393
* Obtains a repository for the passed state class.
9494
*
95-
* @throws IllegalStateException if a repository was not found
96-
* or the repository does not match expectations of this {@code AggregateRoot}
95+
* @throws IllegalStateException
96+
* if a repository was not found,
97+
* or the repository does not match expectations of this {@code AggregateRoot}
9798
*/
9899
private <S extends Message, A extends AggregatePart<I, S, ?>>
99100
AggregatePartRepository<I, A> getRepository(Class<S> stateClass) {

server/src/test/java/org/spine3/server/aggregate/AggregateRootShould.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void setUp() {
5656

5757
@Test
5858
public void return_part_state_by_class() {
59-
final Message part = aggregateRoot.getPart(Project.class);
59+
final Message part = aggregateRoot.getPartState(Project.class);
6060

6161
assertNotNull(part);
6262
}
@@ -66,8 +66,8 @@ public void cache_repositories() {
6666
final AggregateRoot rootSpy = spy(aggregateRoot);
6767
final Class<Project> partClass = Project.class;
6868

69-
rootSpy.getPart(partClass);
70-
rootSpy.getPart(partClass);
69+
rootSpy.getPartState(partClass);
70+
rootSpy.getPartState(partClass);
7171

7272
// It may be called once in another test. So here we check for atMost().
7373
verify(rootSpy, atMost(1)).lookup(partClass);

0 commit comments

Comments
 (0)