### Question:
QueueResource { Long convertDelayParameter(String delayParam) { Long delayMs = 0L; if (!QakkaUtils.isNullOrEmpty(delayParam)) { switch (delayParam.toUpperCase()) { case "NONE": case "": delayMs = 0L; break; default: try { delayMs = Long.parseLong(delayParam); } catch (Exception e) { throw new IllegalArgumentException("Invalid delay parameter"); } break; } } return delayMs; } @Inject  QueueResource(
            QueueManager              queueManager,
            QueueMessageManager       queueMessageManager,
            URIStrategy               uriStrategy,
            Regions                   regions ); @POST @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) Response createQueue(Queue queue ); @PUT @Path( "{queueName}/config" ) @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) Response updateQueueConfig( @PathParam("queueName") String queueName, Queue queue); @DELETE @Path( "{queueName}" ) @Produces({MediaType.APPLICATION_JSON}) Response deleteQueue( @PathParam("queueName") String queueName,
                                 @QueryParam("confirm") @DefaultValue("false") Boolean confirmedParam); @GET @Path( "{queueName}/config" ) @Produces({MediaType.APPLICATION_JSON}) Response getQueueConfig( @PathParam("queueName") String queueName); @GET @Produces({MediaType.APPLICATION_JSON}) List<String> getListOfQueues(); @GET @Path( "{queueName}/stats" ) @Produces({MediaType.APPLICATION_JSON}) Response getQueueStats( @PathParam("queueName") String queueName); @POST @Path( "{queueName}/messages" ) @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response sendMessageJson(
            @PathParam("queueName")                     String queueName,
            @QueryParam("regions" )   @DefaultValue("") String regionsParam,
            @QueryParam("delay")      @DefaultValue("") String delayParam,
            @QueryParam("expiration") @DefaultValue("") String expirationParam,
                                                        String messageBody); @POST @Path( "{queueName}/messages" ) @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) Response sendMessageBinary(
            @PathParam("queueName")                     String queueName,
            @QueryParam("regions" )   @DefaultValue("") String regionsParam,
            @QueryParam("delay")      @DefaultValue("") String delayParam,
            @QueryParam("expiration") @DefaultValue("") String expirationParam,
            @QueryParam("contentType")                  String actualContentType,
                                                        byte[] messageBody); @GET @Path( "{queueName}/messages" ) @Produces({MediaType.APPLICATION_JSON}) Response getNextMessages( @PathParam("queueName") String queueName,
                                     @QueryParam("count") @DefaultValue("1") String countParam); @DELETE @Path( "{queueName}/messages/{queueMessageId}" ) @Produces({MediaType.APPLICATION_JSON}) Response ackMessage( @PathParam("queueName") String queueName,
                                @PathParam("queueMessageId") String queueMessageId); @GET @Path( "{queueName}/data/{queueMessageId}" ) Response getMessageData(
            @PathParam("queueName") String queueName,
            @PathParam("queueMessageId") String queueMessageIdParam );  }### Answer:
@Test public void testConvertDelayParameter() { Injector injector = StartupListener.INJECTOR; QueueResource queueResource = injector.getInstance( QueueResource.class ); Assert.assertEquals( 0L, queueResource.convertDelayParameter( "" ).longValue() ); Assert.assertEquals( 0L, queueResource.convertDelayParameter( "0" ).longValue() ); Assert.assertEquals( 0L, queueResource.convertDelayParameter( "NONE" ).longValue() ); Assert.assertEquals( 5L, queueResource.convertDelayParameter( "5" ).longValue() ); try { queueResource.convertDelayParameter( "bogus value" ); fail("Expected exception on bad value"); } catch ( IllegalArgumentException expected ) { } }