### Question:
BlueprintService extends AbstractWorkspaceAwareResourceService<Blueprint> implements ResourceBasedCrnProvider { public Blueprint getByWorkspace(@NotNull NameOrCrn nameOrCrn, Long workspaceId) { return nameOrCrn.hasName() ? getByNameForWorkspaceId(nameOrCrn.getName(), workspaceId) : getByCrnAndWorkspaceIdAndAddToMdc(nameOrCrn.getCrn(), workspaceId); }  Blueprint get(Long id); Blueprint createForLoggedInUser(Blueprint blueprint, Long workspaceId, String accountId, String creator); Blueprint deleteByWorkspace(NameOrCrn nameOrCrn, Long workspaceId); Blueprint getByWorkspace(@NotNull NameOrCrn nameOrCrn, Long workspaceId); void decorateWithCrn(Blueprint bp, String accountId, String creator); PlatformRecommendation getRecommendation(Long workspaceId, String blueprintName, String credentialName,
            String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType); PlatformRecommendation getRecommendationByCredentialCrn(Long workspaceId, String blueprintName, String credentialCrn,
            String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType); AutoscaleRecommendation getAutoscaleRecommendation(Long workspaceId, String blueprintName); ScaleRecommendation getScaleRecommendation(Long workspaceId, String blueprintName); @Override Set<Blueprint> findAllByWorkspace(Workspace workspace); @Override Set<Blueprint> findAllByWorkspaceId(Long workspaceId); Set<BlueprintView> getAllAvailableViewInWorkspaceAndFilterBySdxReady(Long workspaceId, Boolean withSdx); Set<Blueprint> getAllAvailableInWorkspace(Workspace workspace); Blueprint getByNameForWorkspaceAndLoadDefaultsIfNecessary(String name, Workspace workspace); void updateDefaultBlueprintCollection(Long workspaceId); boolean isDatalakeBlueprint(Blueprint blueprint); boolean isClouderaManagerTemplate(Blueprint blueprint); String getBlueprintVariant(Blueprint blueprint); @Override Blueprint getByNameForWorkspace(String name, Workspace workspace); @Override Blueprint delete(Blueprint blueprint); @Override WorkspaceResourceRepository<Blueprint, Long> repository(); Map<String, String> queryCustomParametersMap(String name, Long workspaceId); Set<ConfigQueryEntry> queryFileSystemParameters(String blueprintName, String clusterName,
            String baseLocation, String fileSystemType, String accountName, boolean attachedCluster,
            boolean secure, Long workspaceId); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnsInAccount(); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceNames); Blueprint getByResourceCrn(String resourceCrn); @Override AuthorizationResourceType getResourceType(); BlueprintStatusView getStatusViewByResourceCrn(String resourceCrn);  }### Answer:
@Test public void testGetByWorkspaceWhenDtoNameFilledThenProperGetCalled() { when(blueprintRepository.findByNameAndWorkspaceId(blueprint.getName(), blueprint.getWorkspace().getId())).thenReturn(Optional.of(blueprint)); Blueprint result = underTest.getByWorkspace(NameOrCrn.ofName(blueprint.getName()), blueprint.getWorkspace().getId()); assertEquals(blueprint, result); verify(blueprintRepository, times(1)) .findByNameAndWorkspaceId(anyString(), anyLong()); verify(blueprintRepository, times(1)) .findByNameAndWorkspaceId(blueprint.getName(), blueprint.getWorkspace().getId()); }
@Test public void testGetByWorkspaceWhenDtoCrnFilledThenProperGetCalled() { when(blueprintRepository.findByResourceCrnAndWorkspaceId(blueprint.getResourceCrn(), blueprint.getWorkspace().getId())).thenReturn(Optional.of(blueprint)); Blueprint result = underTest.getByWorkspace(NameOrCrn.ofCrn(blueprint.getResourceCrn()), blueprint.getWorkspace().getId()); assertEquals(blueprint, result); verify(blueprintRepository, times(1)) .findByResourceCrnAndWorkspaceId(anyString(), anyLong()); verify(blueprintRepository, times(1)) .findByResourceCrnAndWorkspaceId(blueprint.getResourceCrn(), blueprint.getWorkspace().getId()); }