### Question:
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()); } }    }### Answer:
@Test public void testXmlRequestType() { when(reportRequest.getRequestType()).thenReturn(RequestType.XML); ReportBodyProvider reportBodyProvider = reportBodyProviderFactory.getReportBodyProvider(reportRequest); assertEquals("Should get a ReportDefintionReportBodyProvider", ReportDefinitionBodyProvider.class, reportBodyProvider.getClass()); }
@Test public void testAwqlRequestType() { when(reportRequest.getRequestType()).thenReturn(RequestType.AWQL); ReportBodyProvider reportBodyProvider = reportBodyProviderFactory.getReportBodyProvider(reportRequest); assertEquals("Should get an AwqlReportBodyProvider", AwqlReportBodyProvider.class, reportBodyProvider.getClass()); }
@Test public void testNullRequestType() { thrown.expect(NullPointerException.class); reportBodyProviderFactory.getReportBodyProvider(reportRequest); }