org.springframework.test.annotation.DirtiesContext.ClassMode Java Examples

The following examples show how to use org.springframework.test.annotation.DirtiesContext.ClassMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractDirtiesContextTestExecutionListener.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Perform the actual work for {@link #beforeTestClass} and {@link #afterTestClass}
 * by dirtying the context if appropriate (i.e., according to the required mode).
 * @param testContext the test context whose application context should
 * potentially be marked as dirty; never {@code null}
 * @param requiredClassMode the class mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @throws Exception allows any exception to propagate
 * @since 4.2
 * @see #dirtyContext
 */
protected void beforeOrAfterTestClass(TestContext testContext, ClassMode requiredClassMode) throws Exception {
	Assert.notNull(testContext, "TestContext must not be null");
	Assert.notNull(requiredClassMode, "requiredClassMode must not be null");

	Class<?> testClass = testContext.getTestClass();
	Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");

	DirtiesContext dirtiesContext = AnnotatedElementUtils.findMergedAnnotation(testClass, DirtiesContext.class);
	boolean classAnnotated = (dirtiesContext != null);
	ClassMode classMode = (classAnnotated ? dirtiesContext.classMode() : null);

	if (logger.isDebugEnabled()) {
		String phase = (requiredClassMode.name().startsWith("BEFORE") ? "Before" : "After");
		logger.debug(String.format(
			"%s test class: context %s, class annotated with @DirtiesContext [%s] with mode [%s].", phase,
			testContext, classAnnotated, classMode));
	}

	if (classMode == requiredClassMode) {
		dirtyContext(testContext, dirtiesContext.hierarchyMode());
	}
}
 
Example #2
Source File: AbstractDirtiesContextTestExecutionListener.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Perform the actual work for {@link #beforeTestClass} and {@link #afterTestClass}
 * by dirtying the context if appropriate (i.e., according to the required mode).
 * @param testContext the test context whose application context should
 * potentially be marked as dirty; never {@code null}
 * @param requiredClassMode the class mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @throws Exception allows any exception to propagate
 * @since 4.2
 * @see #dirtyContext
 */
protected void beforeOrAfterTestClass(TestContext testContext, ClassMode requiredClassMode) throws Exception {
	Assert.notNull(testContext, "TestContext must not be null");
	Assert.notNull(requiredClassMode, "requiredClassMode must not be null");

	Class<?> testClass = testContext.getTestClass();
	Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");

	DirtiesContext dirtiesContext = AnnotatedElementUtils.findMergedAnnotation(testClass, DirtiesContext.class);
	boolean classAnnotated = (dirtiesContext != null);
	ClassMode classMode = (classAnnotated ? dirtiesContext.classMode() : null);

	if (logger.isDebugEnabled()) {
		String phase = (requiredClassMode.name().startsWith("BEFORE") ? "Before" : "After");
		logger.debug(String.format(
			"%s test class: context %s, class annotated with @DirtiesContext [%s] with mode [%s].", phase,
			testContext, classAnnotated, classMode));
	}

	if (classMode == requiredClassMode) {
		dirtyContext(testContext, dirtiesContext.hierarchyMode());
	}
}
 
Example #3
Source File: AbstractDirtiesContextTestExecutionListener.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Perform the actual work for {@link #beforeTestClass} and {@link #afterTestClass}
 * by dirtying the context if appropriate (i.e., according to the required mode).
 * @param testContext the test context whose application context should
 * potentially be marked as dirty; never {@code null}
 * @param requiredClassMode the class mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @throws Exception allows any exception to propagate
 * @since 4.2
 * @see #dirtyContext
 */
protected void beforeOrAfterTestClass(TestContext testContext, ClassMode requiredClassMode) throws Exception {
	Assert.notNull(testContext, "TestContext must not be null");
	Assert.notNull(requiredClassMode, "requiredClassMode must not be null");

	Class<?> testClass = testContext.getTestClass();
	Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");

	DirtiesContext dirtiesContext = AnnotatedElementUtils.findMergedAnnotation(testClass, DirtiesContext.class);
	boolean classAnnotated = (dirtiesContext != null);
	ClassMode classMode = (classAnnotated ? dirtiesContext.classMode() : null);

	if (logger.isDebugEnabled()) {
		String phase = (requiredClassMode.name().startsWith("BEFORE") ? "Before" : "After");
		logger.debug(String.format(
			"%s test class: context %s, class annotated with @DirtiesContext [%s] with mode [%s].", phase,
			testContext, classAnnotated, classMode));
	}

	if (classMode == requiredClassMode) {
		dirtyContext(testContext, dirtiesContext.hierarchyMode());
	}
}
 
Example #4
Source File: CreateMultipleExecutionsIT.java    From difido-reports with Apache License 2.0 6 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testCreateSeparateExecutions() throws Exception {
	for (int i = 0; i < NUM_OF_EXECUTIONS; i++) {
		ExecutionDetails description = new ExecutionDetails();
		description.setShared(false);
		executionId = client.addExecution(description);
		final MachineNode machine = new MachineNode(MACHINE_NAME);
		final int machineId = client.addMachine(executionId, machine);
		final ScenarioNode scenario = new ScenarioNode(SCENARIO_NAME);
		machine.addChild(scenario);
		final TestNode test = new TestNode(0, TEST_NAME, "0");
		uid = String.valueOf(Math.abs(new Random().nextInt()));
		test.setUid(uid);
		scenario.addChild(test);
		client.updateMachine(executionId, machineId, machine);
		client.endExecution(executionId);
	}
	waitForTasksToFinish();
	final Execution[] executions = getAllExecutions();
	Assert.assertNotNull(executions);
	Assert.assertEquals(NUM_OF_EXECUTIONS, executions.length);
}
 
Example #5
Source File: CreateElementsIT.java    From difido-reports with Apache License 2.0 6 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testAddFile() throws Exception {
	final File file = new File("src/test/resources/top-q.pdf");
	ReportElement element = new ReportElement(details);
	element.setType(ElementType.lnk);
	element.setTime("00:00");
	element.setTitle("My report element");
	element.setMessage(file.getName());
	details.addReportElement(element);
	client.addTestDetails(executionId, details);
	client.addFileFromClasspath(executionId, uid, file);
	waitForTasksToFinish();
	assertExecution();

}
 
Example #6
Source File: CreateElementsIT.java    From difido-reports with Apache License 2.0 6 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testAddReportElement() throws Exception {
	ReportElement element = new ReportElement(details);
	element.setType(ElementType.regular);
	element.setTime("00:00");
	final String title = "My report element";
	element.setTitle(title);
	final String message = "My report element message";
	element.setMessage(message);
	details.addReportElement(element);
	client.addTestDetails(executionId, details);

	waitForTasksToFinish();
	final TestDetails testDetails = assertExecution();
	element = testDetails.getReportElements().get(0);
	Assert.assertEquals(ElementType.regular, element.getType());
	Assert.assertEquals(title, element.getTitle());
	Assert.assertEquals(message, element.getMessage());

}
 
Example #7
Source File: CreateElementsIT.java    From difido-reports with Apache License 2.0 6 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void measureAddReportElements() throws Exception {
	ReportElement element = null;
	for (int i = 0; i < NUM_OF_REPORTS_ELEMENTS; i++) {
		element = new ReportElement(details);
		element.setType(ElementType.regular);
		element.setTime("00:" + i);
		element.setTitle("My report element " + i);
		details.addReportElement(element);
		long start = System.currentTimeMillis();
		client.addTestDetails(executionId, details);
		System.out.println("Element was added in " + (System.currentTimeMillis() - start) + " millis");
	}
	waitForTasksToFinish();
	assertExecution();
	System.out.println("End");

}
 
Example #8
Source File: ReportResourceIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testGetReports() throws Exception {
	ExecutionDetails execution = new ExecutionDetails();
	execution.setShared(false);
	client.addExecution(execution);
	DataTable table = getExecutionMetaData();
	Assert.assertNotNull(table);
}
 
Example #9
Source File: AbstractDirtiesContextTestExecutionListener.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Perform the actual work for {@link #beforeTestMethod} and {@link #afterTestMethod}
 * by dirtying the context if appropriate (i.e., according to the required modes).
 * @param testContext the test context whose application context should
 * potentially be marked as dirty; never {@code null}
 * @param requiredMethodMode the method mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @param requiredClassMode the class mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @throws Exception allows any exception to propagate
 * @since 4.2
 * @see #dirtyContext
 */
protected void beforeOrAfterTestMethod(TestContext testContext, MethodMode requiredMethodMode,
		ClassMode requiredClassMode) throws Exception {

	Assert.notNull(testContext, "TestContext must not be null");
	Assert.notNull(requiredMethodMode, "requiredMethodMode must not be null");
	Assert.notNull(requiredClassMode, "requiredClassMode must not be null");

	Class<?> testClass = testContext.getTestClass();
	Method testMethod = testContext.getTestMethod();
	Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");
	Assert.notNull(testMethod, "The test method of the supplied TestContext must not be null");

	DirtiesContext methodAnn = AnnotatedElementUtils.findMergedAnnotation(testMethod, DirtiesContext.class);
	DirtiesContext classAnn = AnnotatedElementUtils.findMergedAnnotation(testClass, DirtiesContext.class);
	boolean methodAnnotated = (methodAnn != null);
	boolean classAnnotated = (classAnn != null);
	MethodMode methodMode = (methodAnnotated ? methodAnn.methodMode() : null);
	ClassMode classMode = (classAnnotated ? classAnn.classMode() : null);

	if (logger.isDebugEnabled()) {
		String phase = (requiredClassMode.name().startsWith("BEFORE") ? "Before" : "After");
		logger.debug(String.format("%s test method: context %s, class annotated with @DirtiesContext [%s] "
				+ "with mode [%s], method annotated with @DirtiesContext [%s] with mode [%s].", phase, testContext,
			classAnnotated, classMode, methodAnnotated, methodMode));
	}

	if ((methodMode == requiredMethodMode) || (classMode == requiredClassMode)) {
		HierarchyMode hierarchyMode = (methodAnnotated ? methodAnn.hierarchyMode() : classAnn.hierarchyMode());
		dirtyContext(testContext, hierarchyMode);
	}
}
 
Example #10
Source File: ExecutionResourceIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testPut() throws Exception {
	ExecutionDetails executionDetails = new ExecutionDetails();
	int executionId = client.addExecution(executionDetails);
	client.endExecution(executionId);
	
}
 
Example #11
Source File: FileUploadIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void uploadLargeFile() throws Exception {
	String fileName = "test_file.tmp";
	tempFile = new File(System.getProperty("java.io.tmpdir"), fileName);
	writeContentToFile(tempFile, FILE_SIZE_IN_MB);
	long expectedFileSize = tempFile.length();
	client.addFileFromFileSystem(executionId, uid, tempFile);
	waitForTasksToFinish();
	Thread.sleep(500);
	File uploadedFiles[] = findFilesInTest(uid, fileName);
	Assert.assertEquals(1, uploadedFiles.length);
	Assert.assertNotNull(uploadedFiles[0]);
	Assert.assertEquals(expectedFileSize, uploadedFiles[0].length());
}
 
Example #12
Source File: TestDeactiveExecutionIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testCreateAndDestroyExecution() throws Exception {
	final String executionUid = String.valueOf(System.currentTimeMillis() / 10000)
			+ String.valueOf(new Random().nextInt(100));
	final int executionId = client.addExecution(new ExecutionDetails("Testing", true));
	final MachineNode machine = new MachineNode("Machine");
	final int machineId = client.addMachine(executionId, machine);
	Assert.assertNotEquals("Recieved wrong maching id ", -1, machineId);
	final ScenarioNode scenario = new ScenarioNode("Scenario ");
	machine.addChild(scenario);
	for (int i = 0; i < NUM_OF_TESTS_IN_SCENARIO; i++) {
		final String uid = executionUid + "-" + i;
		final TestNode test = new TestNode(i, "Test " , uid);
		scenario.addChild(test);
		client.updateMachine(executionId, machineId, machine);
		TestDetails details = new TestDetails(uid);
		ReportElement element = new ReportElement(details);
		element.setType(ElementType.regular);
		element.setTime("00:" + i);
		element.setTitle("Element from thread #" + i);
		element.setMessage("Element message from thread #" + i);
		details.addReportElement(element);
		client.addTestDetails(executionId, details);
	}
	client.endExecution(executionId);
	//TODO: Assert that execution is no longer active
}
 
Example #13
Source File: ConcurrencyExecutionIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testConcurrentSeparateExecutions() throws Exception {
	Thread[] threads = new Thread[NUM_OF_THREADS];
	long start = System.currentTimeMillis();
	for (int i = 0; i < NUM_OF_THREADS; i++) {
		threads[i] = new ExecutionRunThread(false, NUM_OF_TESTS_IN_SCENARIO);
		threads[i].start();
	}
	for (int i = 0; i < NUM_OF_THREADS; i++) {
		threads[i].join();
	}

	System.out.println("Finished all reports in " + (System.currentTimeMillis() - start) + " millis");

	waitForTasksToFinish();
	start = System.currentTimeMillis();
	Assert.assertEquals(NUM_OF_THREADS, metadataRepository.count());
	final Execution[] executions = getAllExecutions();
	Assert.assertNotNull(executions);
	Assert.assertEquals(NUM_OF_THREADS, executions.length);
	for (int i = 0; i < executions.length; i++) {
		Assert.assertEquals(1, executions[i].getMachines().size());
		final MachineNode machine = executions[i].getMachines().get(0);
		final String threadName = machine.getName();
		Assert.assertEquals(1, machine.getChildren().size());
		final ScenarioNode scenario = machine.getChildren().get(0);
		Assert.assertTrue(scenario.getName().contains(threadName));
		Assert.assertEquals("Number of tests in the scenario is not as expected", NUM_OF_TESTS_IN_SCENARIO,
				scenario.getChildren().size());
		for (int j = 0; j < NUM_OF_TESTS_IN_SCENARIO; j++) {
			final String testName = scenario.getChildren().get(j).getName();
			Assert.assertTrue(testName.contains(threadName));
		}

	}
	System.out.println("Finished assertions in " + (System.currentTimeMillis() - start) + " millis");

}
 
Example #14
Source File: ConcurrencyExecutionIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testConcurrentSharedExecutions() throws Exception {
	Thread[] threads = new Thread[NUM_OF_THREADS];
	long start = System.currentTimeMillis();
	for (int i = 0; i < NUM_OF_THREADS; i++) {
		threads[i] = new ExecutionRunThread(true, NUM_OF_TESTS_IN_SCENARIO);
		threads[i].start();
		// We need to give it a bit time to update the data. If not, we may
		// fail sometime because the server will not find a shared
		// execution.
		Thread.sleep(400);
	}
	for (int i = 0; i < NUM_OF_THREADS; i++) {
		threads[i].join();
	}

	System.out.println("Finished all reports in " + (System.currentTimeMillis() - start) + " millis");
	start = System.currentTimeMillis();

	final Execution execution = getExecution();
	Assert.assertNotNull(execution);
	Assert.assertEquals("Not all machines were joined to a single execution", NUM_OF_THREADS,
			execution.getMachines().size());
	for (int i = 0; i < NUM_OF_THREADS; i++) {
		final MachineNode machine = execution.getMachines().get(0);
		final String threadName = machine.getName();
		Assert.assertEquals(1, machine.getChildren().size());
		final ScenarioNode scenario = machine.getChildren().get(0);
		Assert.assertTrue(scenario.getName().contains(threadName));
		Assert.assertEquals(NUM_OF_TESTS_IN_SCENARIO, scenario.getChildren().size());
		for (int j = 0; j < NUM_OF_TESTS_IN_SCENARIO; j++) {
			final String testName = scenario.getChildren().get(j).getName();
			Assert.assertTrue(testName.contains(threadName));
		}

	}
	System.out.println("Finished assertions in " + (System.currentTimeMillis() - start) + " millis");

}
 
Example #15
Source File: CreateMultipleExecutionsIT.java    From difido-reports with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void testCreateSharedExecutions() throws Exception {
	ExecutionDetails description = new ExecutionDetails();
	description.setShared(true);
	executionId = client.addExecution(description);
	for (int i = 0; i < NUM_OF_EXECUTIONS; i++) {
		final MachineNode machine = new MachineNode(MACHINE_NAME + " " + i);
		final int machineId = client.addMachine(executionId, machine);
		final ScenarioNode scenario = new ScenarioNode(SCENARIO_NAME);
		machine.addChild(scenario);
		final TestNode test = new TestNode(0, TEST_NAME, "0");
		uid = String.valueOf(Math.abs(new Random().nextInt()));
		test.setUid(uid);
		scenario.addChild(test);
		client.updateMachine(executionId, machineId, machine);
	}
	client.endExecution(executionId);
	waitForTasksToFinish();
	final Execution[] executions = getAllExecutions();
	Assert.assertNotNull(executions);
	Assert.assertEquals(1, executions.length);
	Assert.assertNotNull(executions[0].getMachines());
	Assert.assertEquals(NUM_OF_EXECUTIONS, executions[0].getMachines().size());
	for (int i = 0 ; i < NUM_OF_EXECUTIONS ; i++) {
		Assert.assertEquals(MACHINE_NAME + " " + i, executions[0].getMachines().get(i).getName());
	}
}
 
Example #16
Source File: AbstractDirtiesContextTestExecutionListener.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Perform the actual work for {@link #beforeTestMethod} and {@link #afterTestMethod}
 * by dirtying the context if appropriate (i.e., according to the required modes).
 * @param testContext the test context whose application context should
 * potentially be marked as dirty; never {@code null}
 * @param requiredMethodMode the method mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @param requiredClassMode the class mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @throws Exception allows any exception to propagate
 * @since 4.2
 * @see #dirtyContext
 */
protected void beforeOrAfterTestMethod(TestContext testContext, MethodMode requiredMethodMode,
		ClassMode requiredClassMode) throws Exception {

	Assert.notNull(testContext, "TestContext must not be null");
	Assert.notNull(requiredMethodMode, "requiredMethodMode must not be null");
	Assert.notNull(requiredClassMode, "requiredClassMode must not be null");

	Class<?> testClass = testContext.getTestClass();
	Method testMethod = testContext.getTestMethod();
	Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");
	Assert.notNull(testMethod, "The test method of the supplied TestContext must not be null");

	DirtiesContext methodAnn = AnnotatedElementUtils.findMergedAnnotation(testMethod, DirtiesContext.class);
	DirtiesContext classAnn = AnnotatedElementUtils.findMergedAnnotation(testClass, DirtiesContext.class);
	boolean methodAnnotated = (methodAnn != null);
	boolean classAnnotated = (classAnn != null);
	MethodMode methodMode = (methodAnnotated ? methodAnn.methodMode() : null);
	ClassMode classMode = (classAnnotated ? classAnn.classMode() : null);

	if (logger.isDebugEnabled()) {
		String phase = (requiredClassMode.name().startsWith("BEFORE") ? "Before" : "After");
		logger.debug(String.format("%s test method: context %s, class annotated with @DirtiesContext [%s] "
				+ "with mode [%s], method annotated with @DirtiesContext [%s] with mode [%s].", phase, testContext,
			classAnnotated, classMode, methodAnnotated, methodMode));
	}

	if ((methodMode == requiredMethodMode) || (classMode == requiredClassMode)) {
		HierarchyMode hierarchyMode = (methodAnnotated ? methodAnn.hierarchyMode() : classAnn.hierarchyMode());
		dirtyContext(testContext, hierarchyMode);
	}
}
 
Example #17
Source File: AbstractDirtiesContextTestExecutionListener.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Perform the actual work for {@link #beforeTestMethod} and {@link #afterTestMethod}
 * by dirtying the context if appropriate (i.e., according to the required modes).
 * @param testContext the test context whose application context should
 * potentially be marked as dirty; never {@code null}
 * @param requiredMethodMode the method mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @param requiredClassMode the class mode required for a context to
 * be marked dirty in the current phase; never {@code null}
 * @throws Exception allows any exception to propagate
 * @since 4.2
 * @see #dirtyContext
 */
protected void beforeOrAfterTestMethod(TestContext testContext, MethodMode requiredMethodMode,
		ClassMode requiredClassMode) throws Exception {

	Assert.notNull(testContext, "TestContext must not be null");
	Assert.notNull(requiredMethodMode, "requiredMethodMode must not be null");
	Assert.notNull(requiredClassMode, "requiredClassMode must not be null");

	Class<?> testClass = testContext.getTestClass();
	Method testMethod = testContext.getTestMethod();
	Assert.notNull(testClass, "The test class of the supplied TestContext must not be null");
	Assert.notNull(testMethod, "The test method of the supplied TestContext must not be null");

	DirtiesContext methodAnn = AnnotatedElementUtils.findMergedAnnotation(testMethod, DirtiesContext.class);
	DirtiesContext classAnn = AnnotatedElementUtils.findMergedAnnotation(testClass, DirtiesContext.class);
	boolean methodAnnotated = (methodAnn != null);
	boolean classAnnotated = (classAnn != null);
	MethodMode methodMode = (methodAnnotated ? methodAnn.methodMode() : null);
	ClassMode classMode = (classAnnotated ? classAnn.classMode() : null);

	if (logger.isDebugEnabled()) {
		String phase = (requiredClassMode.name().startsWith("BEFORE") ? "Before" : "After");
		logger.debug(String.format("%s test method: context %s, class annotated with @DirtiesContext [%s] "
				+ "with mode [%s], method annotated with @DirtiesContext [%s] with mode [%s].", phase, testContext,
			classAnnotated, classMode, methodAnnotated, methodMode));
	}

	if ((methodMode == requiredMethodMode) || (classMode == requiredClassMode)) {
		HierarchyMode hierarchyMode = (methodAnnotated ? methodAnn.hierarchyMode() : classAnn.hierarchyMode());
		dirtyContext(testContext, hierarchyMode);
	}
}
 
Example #18
Source File: ExecutionResourceIT.java    From difido-reports with Apache License 2.0 4 votes vote down vote up
@Test
@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD)
public void getGet() throws Exception {
	client.addExecution(new ExecutionDetails());
	assertThat(metadataRepository.count(), equalTo(1L));
}