@Test public void testGetAllMedia() { when(Config.mediaService.findAll()).thenReturn(mediaList); final Response response = mediaServiceRest.getMedia(null, "", Config.authenticatedUser); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); }
@Override public Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser) { LOGGER.debug("getMedia with ID {} and name {} by user", id, mediaName, aUser.getUser().getId()); if (id == null && StringUtils.isEmpty(mediaName)) { return ResponseBuilder.ok(mediaService.findAll()); } else if (id != null) { return ResponseBuilder.ok(mediaService.find(id)); } return ResponseBuilder.ok(mediaService.find(mediaName)); }
MediaServiceRestImpl implements MediaServiceRest { @Override public Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser) { LOGGER.debug("getMedia with ID {} and name {} by user", id, mediaName, aUser.getUser().getId()); if (id == null && StringUtils.isEmpty(mediaName)) { return ResponseBuilder.ok(mediaService.findAll()); } else if (id != null) { return ResponseBuilder.ok(mediaService.find(id)); } return ResponseBuilder.ok(mediaService.find(mediaName)); } }
MediaServiceRestImpl implements MediaServiceRest { @Override public Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser) { LOGGER.debug("getMedia with ID {} and name {} by user", id, mediaName, aUser.getUser().getId()); if (id == null && StringUtils.isEmpty(mediaName)) { return ResponseBuilder.ok(mediaService.findAll()); } else if (id != null) { return ResponseBuilder.ok(mediaService.find(id)); } return ResponseBuilder.ok(mediaService.find(mediaName)); }  }
MediaServiceRestImpl implements MediaServiceRest { @Override public Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser) { LOGGER.debug("getMedia with ID {} and name {} by user", id, mediaName, aUser.getUser().getId()); if (id == null && StringUtils.isEmpty(mediaName)) { return ResponseBuilder.ok(mediaService.findAll()); } else if (id != null) { return ResponseBuilder.ok(mediaService.find(id)); } return ResponseBuilder.ok(mediaService.find(mediaName)); }  @Override Response createMedia(final List<Attachment> attachments); @Override Response updateMedia(final JpaMedia media, final AuthenticatedUser aUser); @Override Response removeMedia(final String name, String type, final AuthenticatedUser aUser); @Override Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser); @Override Response getMediaTypes(); }
MediaServiceRestImpl implements MediaServiceRest { @Override public Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser) { LOGGER.debug("getMedia with ID {} and name {} by user", id, mediaName, aUser.getUser().getId()); if (id == null && StringUtils.isEmpty(mediaName)) { return ResponseBuilder.ok(mediaService.findAll()); } else if (id != null) { return ResponseBuilder.ok(mediaService.find(id)); } return ResponseBuilder.ok(mediaService.find(mediaName)); }  @Override Response createMedia(final List<Attachment> attachments); @Override Response updateMedia(final JpaMedia media, final AuthenticatedUser aUser); @Override Response removeMedia(final String name, String type, final AuthenticatedUser aUser); @Override Response getMedia(final Long id, final String mediaName, final AuthenticatedUser aUser); @Override Response getMediaTypes();  }