@Before public void setUp() throws Exception { mockPrintableReportsRegistery = createMock(PrintableReportsRegistry.class); mockApplicationContext = new ExtendedApplicationContextMock(); mockApplicationContext.putBean("printableReportsRegistry", mockPrintableReportsRegistery); application = new MockSpringApplication(); application.setApplicationContext(mockApplicationContext); }
@Test public void printableReportPanelLabelTest() { boolean notLocalisble = false; boolean ready = true; IPrintableReport report = DefaultPrintableReportsRegistryTest.getPrintableReport( Collections.<Locale>emptySet(), "ConsentReport", notLocalisble, ready); // Set Spring asset returned by applicationContext.getMessage(). This is the localized name of // the Report. mockApplicationContext.setMessage("Signed Consent Report"); Set<IPrintableReport> reports = new HashSet<IPrintableReport>(1); reports.add(report); EasyMock.expect(mockPrintableReportsRegistery.availableReports()).andReturn(reports).times(1); EasyMock.expect(mockPrintableReportsRegistery.getReportByName("ConsentReport")) .andReturn(report) .times(1); EasyMock.replay(mockPrintableReportsRegistery); WicketTester tester = new WicketTester(application); tester.startPanel( new TestPanelSource() { private static final long serialVersionUID = 1L; public Panel getTestPanel(String panelId) { return new PrintableReportPanel(panelId); } }); // tester.dumpPage(); EasyMock.verify(mockPrintableReportsRegistery); tester.assertLabel( "panel:group:table:0:rows:reportRow:checkboxLabel:name", "Signed Consent Report"); // tester.assertLabel("panel:group:table:0:rows:reportRow:status", "Ready"); }