Skip to content

Commit

Permalink
Use the expected entity states for batch migration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrykuzmin committed Sep 3, 2020
1 parent 9c2667a commit 453e45f
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 24 deletions.
16 changes: 8 additions & 8 deletions license-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:51 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:44 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -777,7 +777,7 @@ This report was generated on **Thu Sep 03 15:22:51 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:52 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:44 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -1183,7 +1183,7 @@ This report was generated on **Thu Sep 03 15:22:52 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:52 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:45 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -1659,7 +1659,7 @@ This report was generated on **Thu Sep 03 15:22:52 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:53 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:45 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -2082,7 +2082,7 @@ This report was generated on **Thu Sep 03 15:22:53 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:53 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:46 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -2542,7 +2542,7 @@ This report was generated on **Thu Sep 03 15:22:53 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:55 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:48 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -3010,7 +3010,7 @@ This report was generated on **Thu Sep 03 15:22:55 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:56 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:50 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).



Expand Down Expand Up @@ -3514,4 +3514,4 @@ This report was generated on **Thu Sep 03 15:22:56 EEST 2020** using [Gradle-Lic
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.


This report was generated on **Thu Sep 03 15:22:58 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
This report was generated on **Thu Sep 03 19:38:52 EEST 2020** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE).
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,8 @@ void performCustomMigrationForMultiple() {
ImmutableList<TestProcessManager> results = ImmutableList.copyOf(foundAfterMigration);
assertThat(results).hasSize(2);
assertThat(results)
.comparingElementsUsing(idCorrespondence())
.containsExactly(id1, id2);
.comparingElementsUsing(stateWithPropagatedName())
.containsExactly(pm1, pm2);
}

@Test
Expand Down Expand Up @@ -793,8 +793,8 @@ void updateColumnsForMultiple() {
ImmutableList<TestProcessManager> results = ImmutableList.copyOf(found);
assertThat(results).hasSize(2);
assertThat(results)
.comparingElementsUsing(idCorrespondence())
.containsExactly(id1, id2);
.comparingElementsUsing(stateWithUpdatedColumns())
.containsExactly(pm1, pm2);
}

@Test
Expand Down Expand Up @@ -854,11 +854,33 @@ private static TargetFilters targetFilters(QueryFilter first, QueryFilter... res
.build();
}

private static Correspondence<TestProcessManager, ProjectId> idCorrespondence() {
return Correspondence.from(ProcessManagerRepositoryTest::hasId, "has ID");
private static Correspondence<TestProcessManager, TestProcessManager> stateWithPropagatedName() {
return Correspondence.from(ProcessManagerRepositoryTest::hasStateWithName, "has state");
}

private static boolean hasId(TestProcessManager processManager, ProjectId id) {
return id.equals(processManager.id());
private static boolean
hasStateWithName(TestProcessManager actual, TestProcessManager expected) {
Project expectedState = expected
.state()
.toBuilder()
.setIdString(expected.getIdString())
.setName(SetTestProcessName.NEW_NAME)
.build();
return actual.state().equals(expectedState);
}

private static Correspondence<TestProcessManager, TestProcessManager>
stateWithUpdatedColumns() {
return Correspondence.from(ProcessManagerRepositoryTest::hasStateWithColumns, "has state");
}

private static boolean
hasStateWithColumns(TestProcessManager actual, TestProcessManager expected) {
Project expectedState = expected
.state()
.toBuilder()
.setIdString(expected.getIdString())
.build();
return actual.state().equals(expectedState);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ void performCustomMigrationForMultiple() {
ImmutableList<TestProjection> results = ImmutableList.copyOf(foundAfterMigration);
assertThat(results).hasSize(2);
assertThat(results)
.comparingElementsUsing(idCorrespondence())
.containsExactly(id1, id2);
.comparingElementsUsing(stateWithPropagatedName())
.containsExactly(projection1, projection2);
}

@Test
Expand Down Expand Up @@ -696,8 +696,8 @@ void updateColumnsForMultiple() {
ImmutableList<TestProjection> results = ImmutableList.copyOf(found);
assertThat(results).hasSize(2);
assertThat(results)
.comparingElementsUsing(idCorrespondence())
.containsExactly(id1, id2);
.comparingElementsUsing(stateWithUpdatedColumns())
.containsExactly(projection1, projection2);
}

@Test
Expand Down Expand Up @@ -760,11 +760,30 @@ private static TargetFilters targetFilters(QueryFilter first, QueryFilter... res
.build();
}

private static Correspondence<TestProjection, ProjectId> idCorrespondence() {
return Correspondence.from(ProjectionRepositoryTest::hasId, "has ID");
private static Correspondence<TestProjection, TestProjection> stateWithPropagatedName() {
return Correspondence.from(ProjectionRepositoryTest::hasStateWithName, "has state");
}

private static boolean hasId(TestProjection projection, ProjectId id) {
return id.equals(projection.id());
private static boolean hasStateWithName(TestProjection actual, TestProjection expected) {
Project expectedState = expected
.state()
.toBuilder()
.setIdString(expected.getIdString())
.setName(SetTestProjectionName.NEW_NAME)
.build();
return actual.state().equals(expectedState);
}

private static Correspondence<TestProjection, TestProjection> stateWithUpdatedColumns() {
return Correspondence.from(ProjectionRepositoryTest::hasStateWithColumns, "has state");
}

private static boolean hasStateWithColumns(TestProjection actual, TestProjection expected) {
Project expectedState = expected
.state()
.toBuilder()
.setIdString(expected.getIdString())
.build();
return actual.state().equals(expectedState);
}
}

0 comments on commit 453e45f

Please sign in to comment.