private void testGetPutLocateEntryFromShellAndGeode(final Serializable key,
      final Serializable value, Class<?> klass, boolean addRegionPath, boolean expResult) {

    SerializableRunnableIF putTask = () -> {
      Cache cache = ClusterStartupRule.getCache();
      Region<Object, Object> region =
          cache.getRegion(DATA_REGION_NAME_PATH);
      region.clear();
      region.put(key, value);
    };

    SerializableRunnableIF getTask = () -> {
      Cache cache = ClusterStartupRule.getCache();
      Region<Object, Object> region =
          cache.getRegion(DATA_REGION_NAME_PATH);
      assertThat(region.containsKey(key)).isTrue();
      assertThat(value).isEqualTo(region.get(key));
    };

    SerializableRunnableIF removeTask = () -> {
      Cache cache = ClusterStartupRule.getCache();
      Region<Object, Object> region =
          cache.getRegion(DATA_REGION_NAME_PATH);
      assertThat(region.containsKey(key)).isTrue();
      region.remove(key);
    };


    SerializableRunnableIF clearTask = () -> {
      Cache cache = ClusterStartupRule.getCache();
      Region<Object, Object> region =
          cache.getRegion(DATA_REGION_NAME_PATH);
      region.clear();
    };

    String canonicalName = klass.getCanonicalName();
    String getCommand = "get --key=" + key + " --key-class=" + canonicalName
        + " --value-class=" + canonicalName;
    if (addRegionPath) {
      getCommand += " --region=" + DATA_REGION_NAME_PATH;
    }

    String locateEntryCommand = "locate entry --key=" + key + " --key-class="
        + canonicalName + " --value-class=" + canonicalName;
    if (addRegionPath) {
      locateEntryCommand += " --region=" + DATA_REGION_NAME_PATH;
    }

    String removeCommand = "remove --key=" + key + " --key-class=" + canonicalName;
    if (addRegionPath) {
      removeCommand += " --region=" + DATA_REGION_NAME_PATH;
    }
    String putCommand = "put --key=" + key + " --key-class=" + canonicalName
        + " --value=" + value + " --value-class=" + canonicalName;
    if (addRegionPath) {
      putCommand += " --region=" + DATA_REGION_NAME_PATH;
    }

    if (expResult) {
      // Do put from shell check gemfire get do gemfire remove
      gfsh.executeAndAssertThat(putCommand).statusIsSuccess().containsOutput("true");

      server1.invoke(getTask);
      server1.invoke(removeTask);

      server1.invoke(clearTask);

      // Do put from gemfire check from shell do gemfire remove
      server1.invoke(putTask);
      gfsh.executeAndAssertThat(getCommand).statusIsSuccess().containsOutput("true");
      gfsh.executeAndAssertThat(locateEntryCommand).statusIsSuccess().containsOutput("true");
      server1.invoke(removeTask);

      server1.invoke(clearTask);

      // Do put from shell check from gemfire do remove from shell get from shell expect false
      gfsh.executeAndAssertThat(putCommand).statusIsSuccess().containsOutput("true");
      server1.invoke(getTask);
      gfsh.executeAndAssertThat(removeCommand).statusIsSuccess().containsOutput("true");
      gfsh.executeAndAssertThat(getCommand).statusIsSuccess().containsOutput("false");
      gfsh.executeAndAssertThat(locateEntryCommand).statusIsSuccess().containsOutput("false");
    } else {
      // Do put from shell check gemfire get do gemfire remove
      gfsh.executeAndAssertThat(putCommand).statusIsSuccess().containsOutput("false");
      server1.invoke(clearTask);

      // Do put from gemfire check from shell do gemfire remove
      server1.invoke(putTask);
      gfsh.executeAndAssertThat(getCommand).statusIsSuccess().containsOutput("false");
      gfsh.executeAndAssertThat(locateEntryCommand).statusIsSuccess().containsOutput("false");
      server1.invoke(removeTask);
      server1.invoke(clearTask);

      // Do put from shell check from gemfire do remove from shell get from shell expect false
      gfsh.executeAndAssertThat(putCommand).statusIsSuccess().containsOutput("false");
    }
  }
Dunit class for testing gemfire data commands : get, put, remove
geode-dunit/src/main/java/org/apache/geode/management/internal/cli/commands/GeodeDataCommandsDistributedTestBase.java