// Path: src/test/java/com/hubspot/jackson/datatype/protobuf/util/ObjectMapperHelper.java
// public static ObjectMapper camelCase() {
//   return DEFAULT;
// }
// 
// Path: src/test/java/com/hubspot/jackson/datatype/protobuf/util/ObjectMapperHelper.java
// @SuppressWarnings("unchecked")
// public static <T extends MessageOrBuilder> T writeAndReadBack(ObjectMapper mapper, T value) {
//   TreeNode tree = toTree(mapper, value);
// 
//   try {
//     return (T) mapper.treeToValue(tree, value.getClass());
//   } catch (JsonProcessingException e) {
//     throw new RuntimeException(e);
//   }
// }


import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.hubspot.jackson.datatype.protobuf.util.TestProtobuf;
import com.hubspot.jackson.datatype.protobuf.util.TestProtobuf.AllFields;
import org.junit.Test;
import static com.hubspot.jackson.datatype.protobuf.util.ObjectMapperHelper.camelCase;
import static com.hubspot.jackson.datatype.protobuf.util.ObjectMapperHelper.writeAndReadBack;
import static org.assertj.core.api.Assertions.assertThat;
package com.hubspot.jackson.datatype.protobuf;



public class WriteEnumsUsingIndexTest {

  @Test
  public void testEnabled() {
    ObjectMapper mapper = objectMapper(true);

    JsonNode node = mapper.valueToTree(getObject());
    assertThat(node.has("enum")).isTrue();
    assertThat(node.get("enum").isInt()).isTrue();
    assertThat(node.get("enum").intValue()).isEqualTo(2);
  }

  @Test
  public void testDisabled() {
    ObjectMapper mapper = objectMapper(false);

    JsonNode node = mapper.valueToTree(getObject());
    assertThat(node.has("enum")).isTrue();
    assertThat(node.get("enum").isTextual()).isTrue();
    assertThat(node.get("enum").textValue()).isEqualTo("TWO");
  }

  @Test
  public void testRoundTrip() {
// Path: src/test/java/com/hubspot/jackson/datatype/protobuf/util/ObjectMapperHelper.java
// public static ObjectMapper camelCase() {
//   return DEFAULT;
// }
// 
// Path: src/test/java/com/hubspot/jackson/datatype/protobuf/util/ObjectMapperHelper.java
// @SuppressWarnings("unchecked")
// public static <T extends MessageOrBuilder> T writeAndReadBack(ObjectMapper mapper, T value) {
//   TreeNode tree = toTree(mapper, value);
// 
//   try {
//     return (T) mapper.treeToValue(tree, value.getClass());
//   } catch (JsonProcessingException e) {
//     throw new RuntimeException(e);
//   }
// }


// Path: src/test/java/com/hubspot/jackson/datatype/protobuf/WriteEnumsUsingIndexTest.java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.hubspot.jackson.datatype.protobuf.util.TestProtobuf;
import com.hubspot.jackson.datatype.protobuf.util.TestProtobuf.AllFields;
import org.junit.Test;
import static com.hubspot.jackson.datatype.protobuf.util.ObjectMapperHelper.camelCase;
import static com.hubspot.jackson.datatype.protobuf.util.ObjectMapperHelper.writeAndReadBack;
import static org.assertj.core.api.Assertions.assertThat;

package com.hubspot.jackson.datatype.protobuf;



public class WriteEnumsUsingIndexTest {

  @Test
  public void testEnabled() {
    ObjectMapper mapper = objectMapper(true);

    JsonNode node = mapper.valueToTree(getObject());
    assertThat(node.has("enum")).isTrue();
    assertThat(node.get("enum").isInt()).isTrue();
    assertThat(node.get("enum").intValue()).isEqualTo(2);
  }

  @Test
  public void testDisabled() {
    ObjectMapper mapper = objectMapper(false);

    JsonNode node = mapper.valueToTree(getObject());
    assertThat(node.has("enum")).isTrue();
    assertThat(node.get("enum").isTextual()).isTrue();
    assertThat(node.get("enum").textValue()).isEqualTo("TWO");
  }

  @Test
  public void testRoundTrip() {
    AllFields parsed = writeAndReadBack(objectMapper(true), getObject());