@Test
  public void two_objects_with_the_same_value_should_have_the_same_hashcode() {
    UseWithSpecificItem object1 = createAction();
    UseWithSpecificItem object2 = createAction();

    assertEquals(object1.hashCode(), object2.hashCode());
  }
  @Test
  public void user_text_starts_with_what_you_are_using() {
    Item original = makeMockItemWithIDAndName("originalItemID", "original item");
    Item target = makeMockItemWithIDAndName("targetItemID", "target item");
    UseWithSpecificItem action = new UseWithSpecificItem(original, target);

    action.trigger();

    assertThat(
        action.userText(), stringStartsWith("You use the original item with the target item. "));
  }
  @Test
  public void user_text_starts_with_what_you_are_using_excluding_the_for_proper_nouns() {
    Item original = makeMockItemWithIDAndName("originalItemID", "Dave");
    when(original.properNoun()).thenReturn(true);
    Item target = makeMockItemWithIDAndName("targetItemID", "Ipswich");
    when(target.properNoun()).thenReturn(true);
    UseWithSpecificItem action = new UseWithSpecificItem(original, target);

    action.trigger();

    assertThat(action.userText(), stringStartsWith("You use Dave with Ipswich. "));
  }
  @Test
  public void label_is_target_item_name() {
    final Item item = mockery.mock(Item.class);
    mockery.checking(
        new Expectations() {
          {
            allowing(item).name();
            will(returnValue("Item name"));
            ignoring(item);
          }
        });
    UseWithSpecificItem action = new UseWithSpecificItem(null, item);

    assertEquals("Item name", action.label());
  }
  @Test
  public void using_an_item_causes_the_target_item_to_be_used() {
    final Item original = mockery.mock(Item.class, "original");
    final Item target = mockery.mock(Item.class, "target");
    mockery.checking(
        new Expectations() {
          {
            allowing(original).id();
            will(returnValue("originalid"));
            ignoring(original);
            oneOf(target).useWith(original);
            ignoring(target);
          }
        });
    UseWithSpecificItem action = new UseWithSpecificItem(original, target);

    action.trigger();
  }
  @Test
  public void using_an_item_changes_the_user_text_to_the_use_with_message_of_the_target_item() {
    final Item original = mockery.mock(Item.class, "original");
    final Item target = mockery.mock(Item.class, "target");
    mockery.checking(
        new Expectations() {
          {
            ignoring(original);
            allowing(target).canBeUsedWith(original);
            will(returnValue(true));
            allowing(target).useWith(original);
            will(returnValue("use with text"));
            ignoring(target);
          }
        });
    UseWithSpecificItem action = new UseWithSpecificItem(original, target);

    action.trigger();

    assertThat(action.userText(), stringEndsWith("use with text"));
  }