@Test public void testXmlRequestType() { when(reportRequest.getRequestType()).thenReturn(RequestType.XML); ReportBodyProvider reportBodyProvider = reportBodyProviderFactory.getReportBodyProvider(reportRequest); assertEquals("Should get a ReportDefintionReportBodyProvider", ReportDefinitionBodyProvider.class, reportBodyProvider.getClass()); }
ReportBodyProvider getReportBodyProvider(ReportRequest request) { Preconditions.checkNotNull(request, "Null request"); Preconditions.checkNotNull(request.getRequestType(), "Null request type"); switch (request.getRequestType()) { case AWQL: return new AwqlReportBodyProvider(request.getReportRequestString(), request.getDownloadFormat().name()); case XML: return new ReportDefinitionBodyProvider(request.getReportRequestString()); default: throw new IllegalArgumentException( "Unrecognized request type: " + request.getRequestType()); } }
ReportBodyProviderFactory { ReportBodyProvider getReportBodyProvider(ReportRequest request) { Preconditions.checkNotNull(request, "Null request"); Preconditions.checkNotNull(request.getRequestType(), "Null request type"); switch (request.getRequestType()) { case AWQL: return new AwqlReportBodyProvider(request.getReportRequestString(), request.getDownloadFormat().name()); case XML: return new ReportDefinitionBodyProvider(request.getReportRequestString()); default: throw new IllegalArgumentException( "Unrecognized request type: " + request.getRequestType()); } } }
ReportBodyProviderFactory { ReportBodyProvider getReportBodyProvider(ReportRequest request) { Preconditions.checkNotNull(request, "Null request"); Preconditions.checkNotNull(request.getRequestType(), "Null request type"); switch (request.getRequestType()) { case AWQL: return new AwqlReportBodyProvider(request.getReportRequestString(), request.getDownloadFormat().name()); case XML: return new ReportDefinitionBodyProvider(request.getReportRequestString()); default: throw new IllegalArgumentException( "Unrecognized request type: " + request.getRequestType()); } }  }
ReportBodyProviderFactory { ReportBodyProvider getReportBodyProvider(ReportRequest request) { Preconditions.checkNotNull(request, "Null request"); Preconditions.checkNotNull(request.getRequestType(), "Null request type"); switch (request.getRequestType()) { case AWQL: return new AwqlReportBodyProvider(request.getReportRequestString(), request.getDownloadFormat().name()); case XML: return new ReportDefinitionBodyProvider(request.getReportRequestString()); default: throw new IllegalArgumentException( "Unrecognized request type: " + request.getRequestType()); } }   }
ReportBodyProviderFactory { ReportBodyProvider getReportBodyProvider(ReportRequest request) { Preconditions.checkNotNull(request, "Null request"); Preconditions.checkNotNull(request.getRequestType(), "Null request type"); switch (request.getRequestType()) { case AWQL: return new AwqlReportBodyProvider(request.getReportRequestString(), request.getDownloadFormat().name()); case XML: return new ReportDefinitionBodyProvider(request.getReportRequestString()); default: throw new IllegalArgumentException( "Unrecognized request type: " + request.getRequestType()); } }    }