Move custom Truth subjects to gerrit-test-util

To simplify and encourage writing unit tests, the custom Truth subjects
are moved to a Bazel/Buck package which is available to the IT tests as
well as the unit tests.

Change-Id: I529bfa5e8b566a17a05a2ba33c884655bb454dcf
This commit is contained in:
Alice Kober-Sotzek
2016-12-08 11:54:42 +01:00
parent bc8186ad79
commit 4f8edafb7c
7 changed files with 8 additions and 28 deletions

View File

@@ -4,11 +4,4 @@ acceptance_tests(
group = 'api_revision', group = 'api_revision',
srcs = glob(['*IT.java']), srcs = glob(['*IT.java']),
labels = ['api'], labels = ['api'],
deps = [':custom_truth_subjects'],
)
java_library(
name = 'custom_truth_subjects',
srcs = glob(['*Subject.java']),
deps = ['//gerrit-acceptance-tests:lib'],
) )

View File

@@ -4,12 +4,4 @@ acceptance_tests(
srcs = glob(["*IT.java"]), srcs = glob(["*IT.java"]),
group = "api_revision", group = "api_revision",
labels = ["api"], labels = ["api"],
deps = [":custom_truth_subjects"],
)
java_library(
name = "custom_truth_subjects",
testonly = 1,
srcs = glob(["*Subject.java"]),
deps = ["//gerrit-acceptance-tests:lib"],
) )

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.acceptance.api.revision;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.TruthJUnit.assume; import static com.google.common.truth.TruthJUnit.assume;
import static com.google.gerrit.acceptance.PushOneCommit.FILE_NAME; import static com.google.gerrit.acceptance.PushOneCommit.FILE_NAME;
import static com.google.gerrit.acceptance.api.revision.RobotCommentInfoSubject.assertThatList; import static com.google.gerrit.extensions.common.RobotCommentInfoSubject.assertThatList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.AbstractDaemonTest;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.acceptance.api.revision; package com.google.gerrit.extensions.common;
import static com.google.common.truth.Truth.assertAbout; import static com.google.common.truth.Truth.assertAbout;
@@ -22,7 +22,6 @@ import com.google.common.truth.Subject;
import com.google.common.truth.SubjectFactory; import com.google.common.truth.SubjectFactory;
import com.google.common.truth.Truth; import com.google.common.truth.Truth;
import com.google.gerrit.extensions.client.RangeSubject; import com.google.gerrit.extensions.client.RangeSubject;
import com.google.gerrit.extensions.common.FixReplacementInfo;
public class FixReplacementInfoSubject public class FixReplacementInfoSubject
extends Subject<FixReplacementInfoSubject, FixReplacementInfo> { extends Subject<FixReplacementInfoSubject, FixReplacementInfo> {

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.acceptance.api.revision; package com.google.gerrit.extensions.common;
import static com.google.common.truth.Truth.assertAbout; import static com.google.common.truth.Truth.assertAbout;
@@ -21,9 +21,7 @@ import com.google.common.truth.StringSubject;
import com.google.common.truth.Subject; import com.google.common.truth.Subject;
import com.google.common.truth.SubjectFactory; import com.google.common.truth.SubjectFactory;
import com.google.common.truth.Truth; import com.google.common.truth.Truth;
import com.google.gerrit.acceptance.ListSubject; import com.google.gerrit.truth.ListSubject;
import com.google.gerrit.extensions.common.FixReplacementInfo;
import com.google.gerrit.extensions.common.FixSuggestionInfo;
public class FixSuggestionInfoSubject public class FixSuggestionInfoSubject
extends Subject<FixSuggestionInfoSubject, FixSuggestionInfo> { extends Subject<FixSuggestionInfoSubject, FixSuggestionInfo> {

View File

@@ -12,20 +12,18 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.acceptance.api.revision; package com.google.gerrit.extensions.common;
import static com.google.common.truth.Truth.assertAbout; import static com.google.common.truth.Truth.assertAbout;
import com.google.common.truth.FailureStrategy; import com.google.common.truth.FailureStrategy;
import com.google.common.truth.Subject; import com.google.common.truth.Subject;
import com.google.common.truth.SubjectFactory; import com.google.common.truth.SubjectFactory;
import com.google.gerrit.acceptance.ListSubject; import com.google.gerrit.truth.ListSubject;
import com.google.gerrit.extensions.common.FixSuggestionInfo;
import com.google.gerrit.extensions.common.RobotCommentInfo;
import java.util.List; import java.util.List;
class RobotCommentInfoSubject public class RobotCommentInfoSubject
extends Subject<RobotCommentInfoSubject, RobotCommentInfo> { extends Subject<RobotCommentInfoSubject, RobotCommentInfo> {
private static final SubjectFactory<RobotCommentInfoSubject, RobotCommentInfo> private static final SubjectFactory<RobotCommentInfoSubject, RobotCommentInfo>

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.acceptance; package com.google.gerrit.truth;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.truth.Truth.assertAbout; import static com.google.common.truth.Truth.assertAbout;