@Override
  public void register(long ref, String uuid, boolean file) {
    requireNonNull(uuid, "uuid can not be null");
    Long existingRef = refsByUuid.get(uuid);
    if (existingRef != null) {
      checkArgument(ref == existingRef, "Uuid '%s' already registered under ref '%s' in repository", uuid, existingRef);
      boolean existingIsFile = fileUuids.contains(uuid);
      checkArgument(file == existingIsFile, "Uuid '%s' already registered but %sas a File", uuid, existingIsFile ? "" : "not ");
    } else {
      refsByUuid.put(uuid, ref);
      if (file) {
        fileUuids.add(uuid);
      }
    }
  }
@Test
  public void register_throws_IAE_same_uuid_added_with_as_not_file() {
    underTest.register(SOME_REF, SOME_UUID, false);

    assertThatThrownBy(() -> underTest.register(SOME_REF, SOME_UUID, true))
      .isInstanceOf(IllegalArgumentException.class)
      .hasMessage("Uuid '" + SOME_UUID + "' already registered but not as a File");
  }