@GetMapping("/by-namespace/count")
  public long getInstancesCountByNamespace(@RequestParam("appId") String appId,
                                          @RequestParam("clusterName") String clusterName,
                                          @RequestParam("namespaceName") String namespaceName) {
    Page<Instance> instances = instanceService.findInstancesByNamespace(appId, clusterName,
        namespaceName, PageRequest.of(0, 1));
    return instances.getTotalElements();
  }
@Test
  public void testGetInstancesCountByNamespace() throws Exception {
    String someAppId = "someAppId";
    String someClusterName = "someClusterName";
    String someNamespaceName = "someNamespaceName";

    Page<Instance> instances = new PageImpl<>(Collections.emptyList(), pageable, 2);

    when(instanceService.findInstancesByNamespace(eq(someAppId), eq(someClusterName),
        eq(someNamespaceName), any(Pageable.class))).thenReturn(instances);

    long result = instanceConfigController.getInstancesCountByNamespace(someAppId,
        someClusterName, someNamespaceName);

    assertEquals(2, result);
  }