### Question:
CassandraTable { public Map<String, Object> parse(final Event event) { final Map<String, String> headers = ignoreCase ? processHeadersIgnoreCase(event.getHeaders()) : event.getHeaders(); final int maxValues = Math.min(headers.size(), totalColumns); final Map<String, Object> result = new HashMap<String, Object>(maxValues); for (final ColumnMetadata column : columns) { final String columnName = ignoreCase ? column.getName().toLowerCase() : column.getName(); if (headers.containsKey(columnName) && !columnName.equals(bodyColumn)) { result.put(columnName, parseValue(column.getType(), headers.get(columnName))); } else if (columnName.equals(bodyColumn)) { result.put(columnName, parseValue(column.getType(), new String(event.getBody(), Charsets.UTF_8))); } } return result; } CassandraTable(
      final Session session,
      final TableMetadata table,
      final ConsistencyLevel consistencyLevel,
      final String bodyColumn);  CassandraTable(
      final Session session,
      final TableMetadata table,
      final ConsistencyLevel consistencyLevel,
      final String bodyColumn,
      final boolean ignoreCase); void save(final List<Event> events); Map<String, Object> parse(final Event event);  }### Answer:
@Test public void parseWithoutBody() { mockTableMetadata(); final CassandraTable table = new CassandraTable(session, tableMetadata, ConsistencyLevel.QUORUM, null); final Event event = EventBuilder .withBody("my_body".getBytes(), ImmutableMap.of("id", "1", "text_col", "my_text", "other", "foo")); final Map<String, Object> parsedEvent = table.parse(event); assertThat(parsedEvent.size()).isEqualTo(2); assertThat(parsedEvent.get("id")).isEqualTo(1); assertThat(parsedEvent.get("text_col")).isEqualTo("my_text"); }
@Test public void parseWithBody() { mockTableMetadata(); final CassandraTable table = new CassandraTable(session, tableMetadata, ConsistencyLevel.QUORUM, "text_col"); final Event event = EventBuilder .withBody("my_body".getBytes(), ImmutableMap.of("id", "1", "text_col", "my_text", "other", "foo")); final Map<String, Object> parsedEvent = table.parse(event); assertThat(parsedEvent.size()).isEqualTo(2); assertThat(parsedEvent.get("id")).isEqualTo(1); assertThat(parsedEvent.get("text_col")).isEqualTo("my_body"); }