// Path: core/src/main/java/io/t28/json2java/core/naming/DefaultNamePolicy.java
// public enum DefaultNamePolicy implements NamePolicy {
//     CLASS {
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             return format(name, CaseFormat.UPPER_CAMEL);
//         }
//     },
//     METHOD {
//         private static final String BOOLEAN_PREFIX = "is";
//         private static final String GENERAL_PREFIX = "get";
// 
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             final StringBuilder builder = new StringBuilder();
//             if (type.equals(TypeName.BOOLEAN) || type.equals(ClassName.get(Boolean.class))) {
//                 builder.append(BOOLEAN_PREFIX);
//             } else {
//                 builder.append(GENERAL_PREFIX);
//             }
//             return builder.append(format(name, CaseFormat.UPPER_CAMEL))
//                     .toString();
//         }
//     },
//     FIELD {
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             return format(name, CaseFormat.LOWER_CAMEL);
//         }
//     },
//     PARAMETER {
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             return format(name, CaseFormat.LOWER_CAMEL);
//         }
//     };
// 
//     private static final String NO_TEXT = "";
//     private static final String DELIMITER = "_";
//     private static final String DELIMITER_REGEX = "(_|-|\\s|\\.|:)";
//     private static final String CAMEL_CASE_REGEX = "(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])";
//     private static final String INVALID_IDENTIFIER_REGEX = "[^A-Za-z0-9_$]";
// 
//     @Nonnull
//     @CheckReturnValue
//     public static String format(@Nonnull String name, @Nonnull CaseFormat format) {
//         final Matcher matcher = Pattern.compile(DELIMITER_REGEX).matcher(name);
//         final String pattern;
//         if (matcher.find()) {
//             pattern = DELIMITER_REGEX;
//         } else {
//             pattern = CAMEL_CASE_REGEX;
//         }
//         final String snakeCase = Stream.of(name.split(pattern))
//                 .map(Ascii::toLowerCase)
//                 .map(part -> part.replaceAll(INVALID_IDENTIFIER_REGEX, NO_TEXT))
//                 .filter(part -> !Strings.isNullOrEmpty(part))
//                 .collect(Collectors.joining(DELIMITER));
//         return CaseFormat.LOWER_UNDERSCORE.to(format, snakeCase);
//     }
// }
// 
// Path: core/src/test/java/io/t28/json2java/core/Assertions.java
// @Nonnull
// @CheckReturnValue
// public static JsonValueAssert assertThat(@Nullable JsonValue actual) {
//     return new JsonValueAssert(actual);
// }


import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.squareup.moshi.Json;
import io.t28.json2java.core.naming.DefaultNamePolicy;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static io.t28.json2java.core.Assertions.assertThat;
/*
 * Copyright (c) 2017 Tatsuya Maki
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.t28.json2java.core.builder;




public class MoshiClassBuilderTest {
    private MoshiClassBuilder underTest;

    @Before
    public void setUp() throws Exception {
        underTest = new MoshiClassBuilder(
                DefaultNamePolicy.FIELD,
                DefaultNamePolicy.METHOD,
                DefaultNamePolicy.PARAMETER
        );
    }

    @Test
    public void buildFields() throws Exception {
        // setup
        underTest.addProperty("foo", TypeName.INT)
                .addProperty("bar", TypeName.OBJECT)
                .addProperty("baz", TypeName.BOOLEAN);

        // exercise
        final List<FieldSpec> actual = underTest.buildFields();

        // verify
// Path: core/src/main/java/io/t28/json2java/core/naming/DefaultNamePolicy.java
// public enum DefaultNamePolicy implements NamePolicy {
//     CLASS {
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             return format(name, CaseFormat.UPPER_CAMEL);
//         }
//     },
//     METHOD {
//         private static final String BOOLEAN_PREFIX = "is";
//         private static final String GENERAL_PREFIX = "get";
// 
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             final StringBuilder builder = new StringBuilder();
//             if (type.equals(TypeName.BOOLEAN) || type.equals(ClassName.get(Boolean.class))) {
//                 builder.append(BOOLEAN_PREFIX);
//             } else {
//                 builder.append(GENERAL_PREFIX);
//             }
//             return builder.append(format(name, CaseFormat.UPPER_CAMEL))
//                     .toString();
//         }
//     },
//     FIELD {
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             return format(name, CaseFormat.LOWER_CAMEL);
//         }
//     },
//     PARAMETER {
//         @Nonnull
//         @Override
//         public String convert(@Nonnull String name, @Nonnull TypeName type) {
//             return format(name, CaseFormat.LOWER_CAMEL);
//         }
//     };
// 
//     private static final String NO_TEXT = "";
//     private static final String DELIMITER = "_";
//     private static final String DELIMITER_REGEX = "(_|-|\\s|\\.|:)";
//     private static final String CAMEL_CASE_REGEX = "(?<!(^|[A-Z]))(?=[A-Z])|(?<!^)(?=[A-Z][a-z])";
//     private static final String INVALID_IDENTIFIER_REGEX = "[^A-Za-z0-9_$]";
// 
//     @Nonnull
//     @CheckReturnValue
//     public static String format(@Nonnull String name, @Nonnull CaseFormat format) {
//         final Matcher matcher = Pattern.compile(DELIMITER_REGEX).matcher(name);
//         final String pattern;
//         if (matcher.find()) {
//             pattern = DELIMITER_REGEX;
//         } else {
//             pattern = CAMEL_CASE_REGEX;
//         }
//         final String snakeCase = Stream.of(name.split(pattern))
//                 .map(Ascii::toLowerCase)
//                 .map(part -> part.replaceAll(INVALID_IDENTIFIER_REGEX, NO_TEXT))
//                 .filter(part -> !Strings.isNullOrEmpty(part))
//                 .collect(Collectors.joining(DELIMITER));
//         return CaseFormat.LOWER_UNDERSCORE.to(format, snakeCase);
//     }
// }
// 
// Path: core/src/test/java/io/t28/json2java/core/Assertions.java
// @Nonnull
// @CheckReturnValue
// public static JsonValueAssert assertThat(@Nullable JsonValue actual) {
//     return new JsonValueAssert(actual);
// }


// Path: core/src/test/java/io/t28/json2java/core/builder/MoshiClassBuilderTest.java
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import com.squareup.moshi.Json;
import io.t28.json2java.core.naming.DefaultNamePolicy;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static io.t28.json2java.core.Assertions.assertThat;

/*
 * Copyright (c) 2017 Tatsuya Maki
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.t28.json2java.core.builder;




public class MoshiClassBuilderTest {
    private MoshiClassBuilder underTest;

    @Before
    public void setUp() throws Exception {
        underTest = new MoshiClassBuilder(
                DefaultNamePolicy.FIELD,
                DefaultNamePolicy.METHOD,
                DefaultNamePolicy.PARAMETER
        );
    }

    @Test
    public void buildFields() throws Exception {
        // setup
        underTest.addProperty("foo", TypeName.INT)
                .addProperty("bar", TypeName.OBJECT)
                .addProperty("baz", TypeName.BOOLEAN);

        // exercise
        final List<FieldSpec> actual = underTest.buildFields();

        // verify
        assertThat(actual)