### Question:
HistoryController implements HistoryEndpoint { @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.SCALE_DATAHUB) public List<AutoscaleClusterHistoryResponse> getHistoryByName(@ResourceName String stackName, Integer historyCount) { return clusterService.findOneByStackNameAndTenant(stackName, restRequestThreadLocalService.getCloudbreakTenant()) .map(cluster -> historyConverter.convertAllToJson(historyService.getHistory(cluster.getId(), historyCount))) .orElseThrow(NotFoundException.notFound("cluster", stackName)); }  @Override @CheckPermissionByResourceCrn(action = AuthorizationResourceAction.SCALE_DATAHUB) List<AutoscaleClusterHistoryResponse> getHistoryByCrn(@ResourceCrn String stackCrn, Integer historyCount); @Override @CheckPermissionByResourceName(action = AuthorizationResourceAction.SCALE_DATAHUB) List<AutoscaleClusterHistoryResponse> getHistoryByName(@ResourceName String stackName, Integer historyCount);  }### Answer:
@Test public void testGetHistoryByNameWhenHistoryFound() { List<History> mockHistoryResponses = List.of(new History(), new History()); when(clusterService.findOneByStackNameAndTenant(testClusterName, tenant)).thenReturn(Optional.of(cluster)); when(historyService.getHistory(clusterId, 10)).thenReturn(mockHistoryResponses); when(historyConverter.convertAllToJson(any(List.class))).thenCallRealMethod(); List<AutoscaleClusterHistoryResponse> historyResponses = underTest.getHistoryByName(testClusterName, 10); assertEquals("History Response size is 2", 2, historyResponses.size()); }