/*
 * Copyright 2019, TeamDev. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package io.spine.tools.check.vbuild;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.spine.base.FieldPath;

/**
 * Contains statements for which the {@link HandleMethodResult} bug pattern should
 * generate no warning.
 */
abstract class HandleMethodResultNegatives {

    FieldPath callOnVBuilder() {
        FieldPath.Builder builder = FieldPath.newBuilder();
        builder.addFieldName("foo")
               .addFieldName("bar");
        return builder.vBuild();
    }

    @SuppressWarnings("HandleMethodResult")
    void callUnderWarningSuppressed() {
        checkMe();
    }

    @SuppressWarnings("CheckReturnValue")
    void suppressParentCheck() {
        checkMe();
    }

    void callIgnorableMethod() {
        dontCheckMe();
    }

    @CanIgnoreReturnValue
    public String dontCheckMe() {
        return "no";
    }

    public String checkMe() {
        return "42";
    }
}

@@ -1107,16 +1107,123 @@
 nValue;%0A
+import com.google.protobuf.Struct;%0Aimport com.google.protobuf.Timestamp;%0Aimport com.google.protobuf.Value;%0A
 import i
@@ -1416,195 +1416,695 @@
     
-FieldPath callOnVBuilder() %7B%0A        FieldPath.Builder builder = FieldPath.newBuilder();%0A        builder.addFieldName(%22foo%22)%0A               .addFieldName(%22bar%22);%0A        return builder.vB
+Timestamp callSet() %7B%0A        Timestamp.Builder builder = Timestamp.newBuilder();%0A        builder.setNanos(42);%0A        return builder.build();%0A    %7D%0A%0A    FieldPath callAdd() %7B%0A        FieldPath.Builder builder = FieldPath.newBuilder();%0A        builder.addFieldName(%22foo%22)%0A               .addFieldName(%22bar%22);%0A        return builder.vBuild();%0A    %7D%0A%0A    Struct callPut() %7B%0A        Struct.Builder builder = Struct.newBuilder();%0A        builder.putFields(%22foo%22, Value.getDefaultInstance());%0A        return builder.build();%0A    %7D%0A%0A    Struct callMerge() %7B%0A        Struct.Builder builder = Struct.newBuilder();%0A        builder.mergeFrom(Struct.getDefaultInstance());%0A        return builder.b
 uild

Add more test cases