当前位置: 首页>>代码示例>>Java>>正文


Java MultipleFailureException.assertEmpty方法代码示例

本文整理汇总了Java中org.junit.runners.model.MultipleFailureException.assertEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java MultipleFailureException.assertEmpty方法的具体用法?Java MultipleFailureException.assertEmpty怎么用?Java MultipleFailureException.assertEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.runners.model.MultipleFailureException的用法示例。


在下文中一共展示了MultipleFailureException.assertEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: statement

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
private Statement statement(final Statement base, final Description description) {

        return new Statement() {
            public void evaluate() throws Throwable {
                before(description);
                try {
                    List<Throwable> errors = new ArrayList<>();

                    try {
                        base.evaluate();
                        succeededQuietly(description, errors);
                    } catch (Throwable e) {
                        errors.add(e);
                        failedQuietly(e, description, errors);
                    }
                    MultipleFailureException.assertEmpty(errors);
                } finally {
                    after();
                }
            }
        };
    }
 
开发者ID:arquillian,项目名称:smart-testing,代码行数:23,代码来源:TestBed.java

示例2: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            final List<Throwable> errors = new ArrayList<>();

            starting();

            try {
                base.evaluate();
            } catch (Throwable e) {
                errors.add(e);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:apiman,项目名称:apiman-cli,代码行数:20,代码来源:WaitForHttp.java

示例3: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:29,代码来源:FlowableDmnRule.java

示例4: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:27,代码来源:FlowableIdmRule.java

示例5: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
/**
 * Implementation based on {@link TestWatcher}.
 */
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<Throwable>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:29,代码来源:ActivitiRule.java

示例6: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {

    return new Statement() {
        @Override
        public void evaluate() throws Throwable {

            List<Throwable> errors = new ArrayList<Throwable>();

            try {
                starting(description);
                base.evaluate();
                succeeded(description);
            } catch (Throwable e) {
                errors.add(e);
                failed(e, description);
            } finally {
                finished(description);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:testcontainers,项目名称:testcontainers-java,代码行数:25,代码来源:FailureDetectingExternalResource.java

示例7: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, final Description description, final Object[] params) {
	return new Statement() {
		public void evaluate() throws Throwable {
			ArrayList<Throwable> errors = new ArrayList<Throwable>();
			ParameterizedTestWatcher.this.startingQuietly(description, errors, params);

			try {
				base.evaluate();
				ParameterizedTestWatcher.this.succeededQuietly(description, errors, params);
			} catch (AssumptionViolatedException var7) {
				errors.add(var7);
				ParameterizedTestWatcher.this.skippedQuietly(var7, description, errors, params);
			} catch (Throwable var8) {
				errors.add(var8);
				ParameterizedTestWatcher.this.failedQuietly(var8, description, errors, params);
			} finally {
				ParameterizedTestWatcher.this.finishedQuietly(description, errors, params);
			}

			MultipleFailureException.assertEmpty(errors);
		}
	};
}
 
开发者ID:hifive,项目名称:hifive-pitalium,代码行数:25,代码来源:ParameterizedTestWatcher.java

示例8: assertEmptyThrowsMutipleFailureExceptionForManyThrowables

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Test
public void assertEmptyThrowsMutipleFailureExceptionForManyThrowables() throws Exception {
    List<Throwable> errors = new ArrayList<Throwable>();
    errors.add(new ExpectedException("basil"));
    errors.add(new RuntimeException("garlic"));

    try {
        MultipleFailureException.assertEmpty(errors);
        fail();
    } catch (MultipleFailureException expected) {
        assertThat(expected.getFailures(), equalTo(errors));
        assertTrue(expected.getMessage().startsWith("There were 2 errors:\n"));
        assertTrue(expected.getMessage().contains("ExpectedException(basil)\n"));
        assertTrue(expected.getMessage().contains("RuntimeException(garlic)"));
    }
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:MultipleFailureExceptionTest.java

示例9: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            List<Throwable> errors = new ArrayList<Throwable>();

            startingQuietly(description, errors);
            try {
                base.evaluate();
                succeededQuietly(description, errors);
            } catch (AssumptionViolatedException e) {
                errors.add(e);
                skippedQuietly(e, description, errors);
            } catch (Throwable t) {
                errors.add(t);
                failedQuietly(t, description, errors);
            } finally {
                finishedQuietly(description, errors);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:25,代码来源:TestWatcher.java

示例10: should_report_all_errors

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Test
public void should_report_all_errors() throws Throwable {
  try {
    softly.assertThat(1).isEqualTo(1);
    softly.assertThat(1).isEqualTo(2);
    softly.assertThat(Lists.newArrayList(1, 2)).containsOnly(1, 3);
    MultipleFailureException.assertEmpty(softly.errorsCollected());
    fail("Should not reach here");
  } catch (MultipleFailureException e) {
    List<Throwable> failures = e.getFailures();

    assertThat(failures).hasSize(2);
    assertThat(failures.get(0).getMessage()).startsWith("expected:<[2]> but was:<[1]>");
    assertThat(failures.get(1).getMessage()).startsWith(format("%n" +
                                                               "Expecting:%n" +
                                                               "  <[1, 2]>%n" +
                                                               "to contain only:%n" +
                                                               "  <[1, 3]>%n" +
                                                               "elements not found:%n" +
                                                               "  <[3]>%n" +
                                                               "and elements not expected:%n" +
                                                               "  <[2]>%n"));
  }
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:25,代码来源:JUnitSoftAssertionsFailureTest.java

示例11: should_report_all_errors

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Test
public void should_report_all_errors() throws Throwable {
  try {
    softly.then(1).isEqualTo(1);
    softly.then(1).isEqualTo(2);
    softly.then(Lists.newArrayList(1, 2)).containsOnly(1, 3);
    MultipleFailureException.assertEmpty(softly.getErrors());
    fail("Should not reach here");
  } catch (MultipleFailureException e) {
    List<Throwable> failures = e.getFailures();
    assertThat(failures).hasSize(2)
                        .extracting("message")
                        .contains("expected:<[2]> but was:<[1]>",
                                  format("%n" +
                                         "Expecting:%n" +
                                         "  <[1, 2]>%n" +
                                         "to contain only:%n" +
                                         "  <[1, 3]>%n" +
                                         "elements not found:%n" +
                                         "  <[3]>%n" +
                                         "and elements not expected:%n" +
                                         "  <[2]>%n"));
  }
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:25,代码来源:JUnitBDDSoftAssertionsFailureTest.java

示例12: should_report_all_errors

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Test
public void should_report_all_errors() throws Throwable {
  try {
    softly.assertThat(1).isEqualTo(1);
    softly.assertThat(1).isEqualTo(2);
    softly.assertThat(Lists.newArrayList(1, 2)).containsOnly(1, 3);
    MultipleFailureException.assertEmpty(softly.errorsCollected());
    fail("Should not reach here");
  } catch (MultipleFailureException e) {
    List<Throwable> failures = e.getFailures();

    assertThat(failures).hasSize(2);
    assertThat(failures.get(0)).hasMessageContaining("expected:<[2]> but was:<[1]>");
    assertThat(failures.get(1)).hasMessageContaining(format("%n" +
                                                            "Expecting:%n" +
                                                            "  <[1, 2]>%n" +
                                                            "to contain only:%n" +
                                                            "  <[1, 3]>%n" +
                                                            "elements not found:%n" +
                                                            "  <[3]>%n" +
                                                            "and elements not expected:%n" +
                                                            "  <[2]>%n"));
  }
}
 
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:25,代码来源:Java6JUnitSoftAssertionsFailureTest.java

示例13: apply

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Override
public org.junit.runners.model.Statement apply(final org.junit.runners.model.Statement base,
                                               Description description){

    return new org.junit.runners.model.Statement(){
        @Override
        public void evaluate() throws Throwable{
            try{
                setup();
            }catch(SQLException e){
                throw new SetupFailureException(e);
            }
            List<Throwable> errors = new LinkedList<>();
            try{
                base.evaluate();
            }catch(Throwable t){
                errors.add(t);
            }

            MultipleFailureException.assertEmpty(errors);
        }
    };
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:24,代码来源:TableRule.java

示例14: closeResultSets

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
private void closeResultSets() {
    List<Throwable> t = Lists.newArrayListWithExpectedSize(0);
    for (ResultSet r : resultSets) {
        try {
            if (!r.isClosed()) {
                r.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
            t.add(e);
        }
    }
    try {
        MultipleFailureException.assertEmpty(t);
    } catch (Throwable throwable) {
        throw new RuntimeException(throwable);
    }
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:19,代码来源:SpliceWatcher.java

示例15: assertEmptyThrowsMutipleFailureExceptionForManyThrowables

import org.junit.runners.model.MultipleFailureException; //导入方法依赖的package包/类
@Test
public void assertEmptyThrowsMutipleFailureExceptionForManyThrowables() throws Throwable {
    List<Throwable> errors = new ArrayList<Throwable>();
    errors.add(new ExpectedException("basil"));
    errors.add(new RuntimeException("garlic"));

    try {
        MultipleFailureException.assertEmpty(errors);
        fail();
    } catch (MultipleFailureException expected) {
        assertThat(expected.getFailures(), equalTo(errors));
        assertTrue(expected.getMessage().startsWith("There were 2 errors:\n"));
        assertTrue(expected.getMessage().contains("ExpectedException(basil)\n"));
        assertTrue(expected.getMessage().contains("RuntimeException(garlic)"));
    }
}
 
开发者ID:MattiasBuelens,项目名称:junit,代码行数:17,代码来源:MultipleFailureExceptionTest.java


注:本文中的org.junit.runners.model.MultipleFailureException.assertEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。