Skip to content

Commit 5aa2acb

Browse files
Merge pull request #292 from SpineEventEngine/get-part-state
Rename `getPart()` to `getPartState()`
2 parents c0c871d + c3f0b56 commit 5aa2acb

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ buildscript {
3333
guavaVersion = '20.0'
3434
protobufGradlePluginVerison = '0.8.0'
3535

36-
spineVersion = '0.7.23-SNAPSHOT'
36+
spineVersion = '0.7.24-SNAPSHOT'
3737
//TODO:2016-12-12:alexander.yevsyukov: Advance the plug-in version together with all the components and change
3838
// the version of the dependency below to `spineVersion` defined above.
3939
spineProtobufPluginVersion = '0.6.6-SNAPSHOT'

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)