本文整理汇总了Java中com.github.springtestdbunit.annotation.DatabaseTearDown类的典型用法代码示例。如果您正苦于以下问题:Java DatabaseTearDown类的具体用法?Java DatabaseTearDown怎么用?Java DatabaseTearDown使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseTearDown类属于com.github.springtestdbunit.annotation包,在下文中一共展示了DatabaseTearDown类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveNextPageGroupsRandomizationTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
public void resolveNextPageGroupsRandomizationTest() {
List<Integer> visitedQuestionIds = new ArrayList<Integer>();
List<Integer> allQuestionIds = Arrays.asList(13, 12, 29, 30, 31, 35, 39, 50);
Integer questionnaireId = 58;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
visitedQuestionIds.addAll(pageStructure.getQuestionsId());
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
visitedQuestionIds.addAll(pageStructure.getQuestionsId());
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
visitedQuestionIds.addAll(pageStructure.getQuestionsId());
assertThat(visitedQuestionIds).containsAll(allQuestionIds);
}
示例2: resolveNextPageGroupsRandomizationTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionSectionRandomizationEnabled-dataset.xml")
public void resolveNextPageGroupsRandomizationTest() {
Integer questionnaireId = 58;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
List<Section> sections = pageStructure.getSections();
assertThat(sections).hasSize(3);
List<Question> visitedQuestions = new ArrayList<>();
List<Question> allQuestions = getAllQuestions();
Section firstGroup = sections.get(0);
for (Question question : firstGroup.getQuestions()) {
visitedQuestions.add(question);
}
assertThat(allQuestions).containsAll(visitedQuestions);
assertQuestionNumberPresent(sections);
}
示例3: resolveNextPageQuestionRandomizationStrategyTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionQuestionRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionQuestionRandomizationEnabled-dataset.xml")
public void resolveNextPageQuestionRandomizationStrategyTest() {
Integer questionnaireId = 58;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
List<Section> sections = pageStructure.getSections();
assertThat(sections).hasSize(1);
List<Question> visitedQuestions = new ArrayList<>();
List<Question> allQuestions = getAllQuestions();
for (Section section : sections) {
for (Question question : section.getQuestions()) {
visitedQuestions.add(question);
}
}
assertThat(allQuestions).containsAll(visitedQuestions);
assertQuestionNumberPresent(sections);
}
示例4: findByUser
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup(DATA_SET)
@DatabaseTearDown(type = DatabaseOperation.DELETE_ALL, value = DATA_SET)
public void findByUser() throws Exception {
assertThat(((Collection) repository.findAll()).size(), is(13));
assertThat(repository.findByUser("nik").size(), is(6));
assertThat(repository.findByUser("not nik").size(), is(3));
assertThat(repository.findByUser("nik not").size(), is(2));
assertThat(repository.findByUser("java").size(), is(1));
}
示例5: testFindWidgetsBundleByTenantIdAndAlias
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml",type= DatabaseOperation.CLEAN_INSERT)
@DatabaseTearDown(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindWidgetsBundleByTenantIdAndAlias() {
WidgetsBundle widgetsBundle = widgetsBundleDao.findWidgetsBundleByTenantIdAndAlias(
UUID.fromString("250aca8e-2825-11e7-93ae-92361f002671"), "WB3");
assertEquals("44e6af4e-2825-11e7-93ae-92361f002671", widgetsBundle.getId().toString());
}
示例6: testSearchTextNotFound
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("classpath:dbunit/empty_dataset.xml")
@DatabaseTearDown(value = "classpath:dbunit/empty_dataset.xml", type= DatabaseOperation.DELETE_ALL)
public void testSearchTextNotFound() {
UUID tenantId = UUIDs.timeBased();
createWidgetBundles(5, tenantId, "ABC_");
createSystemWidgetBundles(5, "SYS_");
TextPageLink textPageLink = new TextPageLink(30, "TEXT_NOT_FOUND");
List<WidgetsBundle> widgetsBundles4 = widgetsBundleDao.findAllTenantWidgetsBundlesByTenantId(tenantId, textPageLink);
assertEquals(0, widgetsBundles4.size());
}
示例7: testAddPhone
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("/dbtest/setup/customSampleData.xml")
@ExpectedDatabase(assertionMode = DatabaseAssertionMode.NON_STRICT, value = "/dbtest/expected/customService_testAddPhone.xml")
@DatabaseTearDown(type=DatabaseOperation.DELETE, value="/dbtest/expected/customService_testAddPhone.xml")
public void testAddPhone() {
customService.addCustomerPhone("CLIKE", "555-1234");
customService.addCustomerPhone("CLIKE", "02-3456");
}
示例8: createForSectionNoRandomizationTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@DatabaseSetup("PageMetadataCreatorTest-dataset.xml")
@DatabaseTearDown("PageMetadataCreatorTest-dataset.xml")
@Test
public void createForSectionNoRandomizationTest() {
Breadcrumb breadcrumb = breadcrumbService.findOne(201);
PageMetadataStructure metadata = pageMetadataCreator.create(RandomizationStrategy.NONE,
RenderingMode.SECTION_BY_SECTION, breadcrumb);
assertThat(metadata.getCount()).isEqualTo(3);
assertThat(metadata.getNumber()).isEqualTo(3);
}
示例9: createRandomizationPerQuestionEnabledTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("PageMetadataCreatorQuestionRandomizationStrategyTest-dataset.xml")
@DatabaseTearDown("PageMetadataCreatorQuestionRandomizationStrategyTest-dataset.xml")
public void createRandomizationPerQuestionEnabledTest() {
Breadcrumb breadcrumb = breadcrumbService.findOne(103);
PageMetadataStructure metadata = pageMetadataCreator.create(RandomizationStrategy.QUESTIONS_RANDOMIZATION,
RenderingMode.SECTION_BY_SECTION, breadcrumb);
assertThat(metadata.getCount()).isEqualTo(8);
assertThat(metadata.getNumber()).isEqualTo(2);
}
示例10: resolveNextPageNoRandomizationTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
public void resolveNextPageNoRandomizationTest() {
Integer questionnaireId = 58;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
List<Section> sections = pageStructure.getSections();
assertThat(sections).hasSize(3);
Section firstGroup = sections.get(0);
assertThat(firstGroup.getId()).isEqualTo(9);
assertThat(firstGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(13).build(), Question.with().id(12).build(), Question.with().id(29)
.build()));
Section secondGroup = sections.get(1);
assertThat(secondGroup.getId()).isEqualTo(10);
assertThat(secondGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(30).build(), Question.with().id(31).build(), Question.with().id(35)
.build()));
Section thirdGroup = sections.get(2);
assertThat(thirdGroup.getId()).isEqualTo(11);
assertThat(thirdGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(39).build(), Question.with().id(50).build()));
assertQuestionNumberPresent(sections);
}
示例11: resolveNextPageNoRandomizationEnabledDirty
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabledGroupByGroupStarted-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabledGroupByGroupStarted-dataset.xml")
public void resolveNextPageNoRandomizationEnabledDirty() {
Integer questionnaireId = 58;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
List<Section> sections = pageStructure.getSections();
assertThat(sections).hasSize(3);
Section firstGroup = sections.get(0);
assertThat(firstGroup.getId()).isEqualTo(9);
assertThat(firstGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(13).build(), Question.with().id(12).build(), Question.with().id(29)
.build()));
Section secondGroup = sections.get(1);
assertThat(secondGroup.getId()).isEqualTo(10);
assertThat(secondGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(30).build(), Question.with().id(31).build(), Question.with().id(35)
.build()));
Section thirdGroup = sections.get(2);
assertThat(thirdGroup.getId()).isEqualTo(11);
assertThat(thirdGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(39).build(), Question.with().id(50).build()));
assertQuestionNumberPresent(sections);
}
示例12: resolveNextPageNoRandomizationEnabledStarted
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabledAllInOneStarted-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabledAllInOneStarted-dataset.xml")
public void resolveNextPageNoRandomizationEnabledStarted() {
Integer questionnaireId = 58;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
List<Section> sections = pageStructure.getSections();
assertThat(sections).hasSize(3);
Section firstGroup = sections.get(0);
assertThat(firstGroup.getId()).isEqualTo(9);
assertThat(firstGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(13).build(), Question.with().id(12).build(), Question.with().id(29)
.build()));
Section secondGroup = sections.get(1);
assertThat(secondGroup.getId()).isEqualTo(10);
assertThat(secondGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(30).build(), Question.with().id(31).build(), Question.with().id(35)
.build()));
Section thirdGroup = sections.get(2);
assertThat(thirdGroup.getId()).isEqualTo(11);
assertThat(thirdGroup.getQuestions()).isEqualTo(
Arrays.asList(Question.with().id(39).build(), Question.with().id(50).build()));
assertQuestionNumberPresent(sections);
}
示例13: testFindAll
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup(value = "classpath:dbunit/widgets_bundle.xml",type= DatabaseOperation.CLEAN_INSERT)
@DatabaseTearDown(value = "classpath:dbunit/widgets_bundle.xml", type= DatabaseOperation.DELETE_ALL)
public void testFindAll() {
assertEquals(7, widgetsBundleDao.find().size());
}
示例14: resolveNextPageNoRandomizationTest
import com.github.springtestdbunit.annotation.DatabaseTearDown; //导入依赖的package包/类
@Test
@DatabaseSetup("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
@DatabaseTearDown("QuestionnaireDefinitionNoRandomizationEnabled-dataset.xml")
public void resolveNextPageNoRandomizationTest() {
Integer questionnaireId = 58;
int questionNumberCounter = 1;
Questionnaire questionnaire = questionnaireService.findOne(questionnaireId);
PageStructure pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.ENTERING);
List<Integer> questionIds = pageStructure.getQuestionsId();
assertThat(questionIds).containsExactly(13);
assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);
// Testing out of range
boolean exceptionThrown = false;
try {
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.PREVIOUS);
}catch(IllegalArgumentException e){
exceptionThrown = true;
}
assertThat(exceptionThrown);
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
questionIds = pageStructure.getQuestionsId();
assertThat(questionIds).containsExactly(12);
assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
questionIds = pageStructure.getQuestionsId();
assertThat(questionIds).containsExactly(29);
assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
questionIds = pageStructure.getQuestionsId();
assertThat(questionIds).containsExactly(30);
assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
questionIds = pageStructure.getQuestionsId();
assertThat(questionIds).containsExactly(31);
assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);
pageStructure = resolver.resolveNextPage(questionnaire, NavigationAction.NEXT);
questionIds = pageStructure.getQuestionsId();
assertThat(questionIds).containsExactly(35);
assertThat(pageStructure.getSections().get(0).getQuestions().get(0).getNumber()).isEqualTo(questionNumberCounter++);
}