Line data Source code
1 : // Copyright (C) 2016 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.common.testing; 16 : 17 : import static com.google.common.truth.Truth.assertAbout; 18 : import static com.google.gerrit.extensions.common.testing.RangeSubject.ranges; 19 : 20 : import com.google.common.truth.FailureMetadata; 21 : import com.google.common.truth.StringSubject; 22 : import com.google.common.truth.Subject; 23 : import com.google.gerrit.extensions.common.FixReplacementInfo; 24 : 25 : public class FixReplacementInfoSubject extends Subject { 26 : 27 : public static FixReplacementInfoSubject assertThat(FixReplacementInfo fixReplacementInfo) { 28 0 : return assertAbout(fixReplacements()).that(fixReplacementInfo); 29 : } 30 : 31 : public static Subject.Factory<FixReplacementInfoSubject, FixReplacementInfo> fixReplacements() { 32 1 : return FixReplacementInfoSubject::new; 33 : } 34 : 35 : private final FixReplacementInfo fixReplacementInfo; 36 : 37 : private FixReplacementInfoSubject( 38 : FailureMetadata failureMetadata, FixReplacementInfo fixReplacementInfo) { 39 1 : super(failureMetadata, fixReplacementInfo); 40 1 : this.fixReplacementInfo = fixReplacementInfo; 41 1 : } 42 : 43 : public StringSubject path() { 44 1 : isNotNull(); 45 1 : return check("path").that(fixReplacementInfo.path); 46 : } 47 : 48 : public RangeSubject range() { 49 1 : isNotNull(); 50 1 : return check("range").about(ranges()).that(fixReplacementInfo.range); 51 : } 52 : 53 : public StringSubject replacement() { 54 1 : isNotNull(); 55 1 : return check("replacement").that(fixReplacementInfo.replacement); 56 : } 57 : }