<commit_before>// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.testsystems.slim.tables;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import fitnesse.testsystems.slim.SlimTestContext;
import fitnesse.testsystems.slim.Table;
import fitnesse.testsystems.slim.results.Result;

public class SlimErrorTable extends SlimTable {
  public SlimErrorTable(Table table, String id, SlimTestContext testContext) {
    super(table, id, testContext);
  }

  protected String getTableType() {
    return "UnknownTableType";
  }

  public List<Object> getInstructions() {
    return Collections.emptyList();
  }

  public void evaluateExpectations(Map<String, Object> returnValues) {
    String tableType = table.getCellContents(0, 0);
    Result errorMessage = fail(String.format("\"%s\" is not a valid table type.", tableType));
    table.setCell(0, 0, errorMessage);
  }
}
<commit_msg>Make SlimErrorTable set an expectation for the error results.<commit_after>// Copyright (C) 2003-2009 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the CPL Common Public License version 1.0.
package fitnesse.testsystems.slim.tables;

import java.util.Collections;
import java.util.List;
import fitnesse.testsystems.slim.SlimTestContext;
import fitnesse.testsystems.slim.Table;
import fitnesse.testsystems.slim.results.Result;

public class SlimErrorTable extends SlimTable {
  public SlimErrorTable(Table table, String id, SlimTestContext testContext) {
    super(table, id, testContext);
  }

  protected String getTableType() {
    return "UnknownTableType";
  }

  public List<Object> getInstructions() {
    addExpectation(new SlimErrorTableExpectation(getInstructionTag()));
    return Collections.emptyList();
  }

  public class SlimErrorTableExpectation implements Expectation {

    private final String instructionTag;

    public SlimErrorTableExpectation(String instructionTag) {
      this.instructionTag = instructionTag;
    }

    @Override
    public void evaluateExpectation(Object returnValues) {
      String tableType = table.getCellContents(0, 0);
      Result errorMessage = fail(String.format("\"%s\" is not a valid table type.", tableType));
      table.setCell(0, 0, errorMessage);
    }

    @Override
    public String getInstructionTag() {
      return instructionTag;
    }

  }
}

{'fraction_non_alphanumeric': 0.09405537459283388, 'fraction_numerical': 0.011400651465798045, 'mean_word_length': 4.4118942731277535, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3224024', 'n_tokens_mistral': 747, 'n_tokens_neox': 706, 'n_words': 196}