Search in sources :

Example 1 with DefaultExportFormat

use of org.olat.modules.qpool.model.DefaultExportFormat in project OpenOLAT by OpenOLAT.

the class QuestionPoolServiceImplTest method shouldGetExportFormatOptions.

@Test
public void shouldGetExportFormatOptions() {
    String formatA = "A";
    String formatB = "B";
    QuestionItemImpl formatAItem = new QuestionItemImpl();
    formatAItem.setFormat(formatA);
    List<QuestionItemShort> items = Arrays.asList(formatAItem);
    ExportFormatOptions exportFormatAR = new DefaultExportFormat(formatA, Outcome.repository, null);
    ExportFormatOptions exportFormatAD = new DefaultExportFormat(formatA, Outcome.download, null);
    List<ExportFormatOptions> exportFormatsA = Arrays.asList(exportFormatAD, exportFormatAR);
    ExportFormatOptions exportFormatBR = new DefaultExportFormat(formatA, Outcome.repository, null);
    List<ExportFormatOptions> exportFormatsB = Arrays.asList(exportFormatBR);
    QPoolSPI spiA = mock(QPoolSPI.class);
    when(spiA.getTestExportFormats()).thenReturn(exportFormatsA);
    when(qPoolModuleMock.getQuestionPoolProvider(formatA)).thenReturn(spiA);
    QPoolSPI spiB = mock(QPoolSPI.class);
    when(spiB.getTestExportFormats()).thenReturn(exportFormatsB);
    when(qPoolModuleMock.getQuestionPoolProvider(formatB)).thenReturn(spiB);
    Set<ExportFormatOptions> exportFormatOptions = sut.getExportFormatOptions(items, Outcome.repository);
    assertThat(exportFormatOptions).hasSize(1).containsExactly(exportFormatAR);
}
Also used : ExportFormatOptions(org.olat.modules.qpool.ExportFormatOptions) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) QPoolSPI(org.olat.modules.qpool.QPoolSPI) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) DefaultExportFormat(org.olat.modules.qpool.model.DefaultExportFormat) Test(org.junit.Test)

Example 2 with DefaultExportFormat

use of org.olat.modules.qpool.model.DefaultExportFormat in project openolat by klemens.

the class QuestionPoolServiceImplTest method shouldGetExportFormatOptions.

@Test
public void shouldGetExportFormatOptions() {
    String formatA = "A";
    String formatB = "B";
    QuestionItemImpl formatAItem = new QuestionItemImpl();
    formatAItem.setFormat(formatA);
    List<QuestionItemShort> items = Arrays.asList(formatAItem);
    ExportFormatOptions exportFormatAR = new DefaultExportFormat(formatA, Outcome.repository, null);
    ExportFormatOptions exportFormatAD = new DefaultExportFormat(formatA, Outcome.download, null);
    List<ExportFormatOptions> exportFormatsA = Arrays.asList(exportFormatAD, exportFormatAR);
    ExportFormatOptions exportFormatBR = new DefaultExportFormat(formatA, Outcome.repository, null);
    List<ExportFormatOptions> exportFormatsB = Arrays.asList(exportFormatBR);
    QPoolSPI spiA = mock(QPoolSPI.class);
    when(spiA.getTestExportFormats()).thenReturn(exportFormatsA);
    when(qPoolModuleMock.getQuestionPoolProvider(formatA)).thenReturn(spiA);
    QPoolSPI spiB = mock(QPoolSPI.class);
    when(spiB.getTestExportFormats()).thenReturn(exportFormatsB);
    when(qPoolModuleMock.getQuestionPoolProvider(formatB)).thenReturn(spiB);
    Set<ExportFormatOptions> exportFormatOptions = sut.getExportFormatOptions(items, Outcome.repository);
    assertThat(exportFormatOptions).hasSize(1).containsExactly(exportFormatAR);
}
Also used : ExportFormatOptions(org.olat.modules.qpool.ExportFormatOptions) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) QPoolSPI(org.olat.modules.qpool.QPoolSPI) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) DefaultExportFormat(org.olat.modules.qpool.model.DefaultExportFormat) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)2 QPoolSPI (org.olat.modules.qpool.QPoolSPI)2 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)2 DefaultExportFormat (org.olat.modules.qpool.model.DefaultExportFormat)2 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)2