// Path: core/src/main/java/com/github/phantomthief/util/ToStringHelper.java
// public class ToStringHelper {
// 
//     public static <T> T wrapToString(Class<T> interfaceType, T obj,
//             Function<T, String> toStringSupplier) {
//         return newProxy(interfaceType, (proxy, method, args) -> {
//             if (method.getName().equals("toString")) {
//                 return toStringSupplier.apply(obj);
//             } else {
//                 return method.invoke(obj, args);
//             }
//         });
//     }
// }


import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.junit.jupiter.api.Test;
import com.github.phantomthief.util.ToStringHelper;
package com.github.phantomthief.test;





/**
 * @author w.vela
 * Created on 16/5/7.
 */
class ToStringHelperTest {

    @Test
    void test() {
        List<Integer> list = Arrays.asList(1, 2, 3);
        String ori = list.toString();
// Path: core/src/main/java/com/github/phantomthief/util/ToStringHelper.java
// public class ToStringHelper {
// 
//     public static <T> T wrapToString(Class<T> interfaceType, T obj,
//             Function<T, String> toStringSupplier) {
//         return newProxy(interfaceType, (proxy, method, args) -> {
//             if (method.getName().equals("toString")) {
//                 return toStringSupplier.apply(obj);
//             } else {
//                 return method.invoke(obj, args);
//             }
//         });
//     }
// }


// Path: core/src/test/java/com/github/phantomthief/test/ToStringHelperTest.java
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.junit.jupiter.api.Test;
import com.github.phantomthief.util.ToStringHelper;

package com.github.phantomthief.test;





/**
 * @author w.vela
 * Created on 16/5/7.
 */
class ToStringHelperTest {

    @Test
    void test() {
        List<Integer> list = Arrays.asList(1, 2, 3);
        String ori = list.toString();
        List<Integer> list2 = ToStringHelper.wrapToString(List.class, list, i -> i + "!!!!");