/*
 * Copyright 2018, 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.code.js;

import com.google.protobuf.Any;
import io.spine.code.proto.MessageType;
import io.spine.code.proto.Type;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

@DisplayName("MethodReference should")
class MethodReferenceTest {

    private static final String METHOD_NAME = "method";

    private final Type type = MessageType.of(Any.getDescriptor());

    @Test
    @DisplayName("provide reference to an instance method")
    void instanceMethod() {
        MethodReference reference = MethodReference.onType(type, METHOD_NAME);
        String expectedName = "proto.google.protobuf.Any.prototype.method";
        assertEquals(expectedName, reference.value());
    }

    @Test
    @DisplayName("provide reference to a static method")
    void staticMethod() {
        MethodReference reference = MethodReference.onPrototype(type, METHOD_NAME);
        String expectedName = "proto.google.protobuf.Any.method";
        assertEquals(expectedName, reference.value());
    }
}

@@ -1623,17 +1623,22 @@
 rence.on
-T
+Protot
 ype(type
@@ -1930,38 +1930,33 @@
 thodReference.on
-Protot
+T
 ype(type, METHOD

Use proper test data