AutomationGroupResource { @Timed @ExceptionMetered @GET @Path("{groupId}") public GroupDetailResponse getGroupById( @Auth AutomationClient automationClient, @PathParam("groupId") LongParam groupId) { Group group = groupDAO.getGroupById(groupId.get()).orElseThrow(NotFoundException::new); ImmutableList<Client> clients = ImmutableList.copyOf(aclDAO.getClientsFor(group)); ImmutableList<SanitizedSecret> sanitizedSecrets = ImmutableList.copyOf(aclDAO.getSanitizedSecretsFor(group)); return GroupDetailResponse.fromGroup(group, sanitizedSecrets, clients); } @Inject  AutomationGroupResource(GroupDAOFactory groupDAOFactory, AclDAOFactory aclDAOFactory,
      AuditLog auditLog); @VisibleForTesting  AutomationGroupResource(GroupDAO groupDAO, AclDAO aclDAO, AuditLog auditLog); @Timed @ExceptionMetered @GET @Path("{groupId}") GroupDetailResponse getGroupById(
      @Auth AutomationClient automationClient,
      @PathParam("groupId") LongParam groupId); @Timed @ExceptionMetered @GET Response getGroupByName(
      @Auth AutomationClient automationClient,
      @QueryParam("name") Optional<String> name); @Timed @ExceptionMetered @POST @Consumes(APPLICATION_JSON) Group createGroup(
      @Auth AutomationClient automationClient,
      @Valid CreateGroupRequest groupRequest); @Timed @ExceptionMetered @DELETE @Path("{groupId}") Response deleteGroup(
      @Auth AutomationClient automationClient,
      @PathParam("groupId") LongParam groupId);  }
@Test public void findGroupById() { Group group = new Group(50, "testGroup", "testing group", now, "automation client", now, "automation client", ImmutableMap.of("app", "keywhiz")); when(groupDAO.getGroupById(50)).thenReturn(Optional.of(group)); when(aclDAO.getClientsFor(group)).thenReturn(ImmutableSet.of()); when(aclDAO.getSanitizedSecretsFor(group)).thenReturn(ImmutableSet.of()); GroupDetailResponse expectedResponse = GroupDetailResponse.fromGroup(group, ImmutableList.of(), ImmutableList.of()); GroupDetailResponse response = resource.getGroupById(automation, new LongParam("50")); assertThat(response).isEqualTo(expectedResponse); }