Java 类junit.framework.Test 实例源码

项目:incubator-netbeans    文件:ExpandFolderTest.java   
private void iterateTests(TestResult result, StringBuffer times, TestSuite suite, AtomicLong min, AtomicLong max) {
    Enumeration en = suite.tests();
    while (en.hasMoreElements()) {
        Test t = (Test)en.nextElement();
        if (t instanceof Callable) {
            try {
                Long v = (Long)((Callable) t).call();
                long time = v.longValue();
                if (time < min.longValue()) {
                    min.set(time);
                }
                if (time > max.longValue()) {
                    max.set(time);
                }
                // append(t.toString()).append(" value: ")
                times.append("Run: ").append(v).append('\n');
            } catch (Exception ex) {
                result.addError(this, ex);
            }
        }
        if (t instanceof TestSuite) {
            iterateTests(result, times, (TestSuite)t, min, max);
        }
    }
}
项目:incubator-netbeans    文件:TestCreationTestSuite.java   
public static Test suite() {
    return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
            .addTest(GotoTest.class, 
                    "testSelectTestFromMainMenu",
                    "testSelectTestFromExplorer",
                    "testSelectTestFromEditorContextMenu")
            .addTest(CreateTestTest.class, 
                    "testCreateTestByPopup",
                    "testCreateTestByPopup2",
                    "testCreateTestByPopup3",
                    "testCreateTestByPopup4",
                    "testCreateTestByWizard",
                    "testCreateWODefMethodBodies",
                    "testCreateWOHints",
                    "testCreateWOJavadoc",
                    "testCreateWOsetUp",
                    "testCreateWOtearDown",
                    "testCreateTestAndSuiteByPopup",
                    "testCreateTestAndSuiteByPopup2",
                    "testCreateIntegrationTestAndSuiteByPopup")
            .enableModules(".*").clusters(".*"));
}
项目:googles-monorepo-demo    文件:TestsForListsInJavaUtil.java   
public Test testsForSingletonList() {
  return ListTestSuiteBuilder.using(
          new TestStringListGenerator() {
            @Override
            public List<String> create(String[] elements) {
              return Collections.singletonList(elements[0]);
            }
          })
      .named("singletonList")
      .withFeatures(
          CollectionFeature.SERIALIZABLE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ONE)
      .suppressing(suppressForSingletonList())
      .createTestSuite();
}
项目:incubator-netbeans    文件:NbModuleSuiteTest.java   
public void testTwoClassesAtOnce() throws Exception {
    System.setProperty("ins.one", "No");
    System.setProperty("ins.two", "No");
    System.setProperty("ins.three", "No");
    System.setProperty("en.one", "No");

    NbModuleSuite.Configuration config = NbModuleSuite.Configuration.create(
        AskForOrgOpenideUtilEnumClass.class
    ).enableModules("org.openide.util.enumerations").gui(false)
    .addTest(NbModuleSuiteIns.class, "testSecond");
    Test instance = config.suite();
    junit.textui.TestRunner.run(instance);

    assertProperty("en.one", "OK");
    assertProperty("ins.one", "No");
    assertProperty("ins.two", "OK");
    assertProperty("ins.three", "No");
}
项目:guava-mock    文件:SetsTest.java   
@GwtIncompatible // suite
private static Test testsForFilter() {
  return SetTestSuiteBuilder.using(new TestStringSetGenerator() {
        @Override public Set<String> create(String[] elements) {
          Set<String> unfiltered = Sets.newLinkedHashSet();
          unfiltered.add("yyy");
          Collections.addAll(unfiltered, elements);
          unfiltered.add("zzz");
          return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
项目:sstore-soft    文件:VoltJUnitFormatter.java   
@Override
public void addError(Test arg0, Throwable arg1) {
    String testName = "unknown";
    if (arg0 != null) {
        testName = arg0.toString();
        int idx = testName.indexOf('(');
        if (idx > 0) { 
            testName = testName.substring(0, idx);
        }
    }

    out.println("    " + testName + " had an error.");
    StackTraceElement[] st = arg1.getStackTrace();
    int i = 0;
    for (StackTraceElement ste : st) {
        if (ste.getClassName().contains("org.voltdb") == false)
            continue;
        out.printf("        %s(%s:%d)\n", ste.getClassName(), ste.getFileName(), ste.getLineNumber());
        if (++i == 3) break;
    }
    m_errs++;
}
项目:googles-monorepo-demo    文件:TestsForListsInJavaUtil.java   
public Test testsForArraysAsList() {
  return ListTestSuiteBuilder.using(
          new TestStringListGenerator() {
            @Override
            public List<String> create(String[] elements) {
              return Arrays.asList(elements.clone());
            }
          })
      .named("Arrays.asList")
      .withFeatures(
          ListFeature.SUPPORTS_SET,
          CollectionFeature.SERIALIZABLE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY)
      .suppressing(suppressForArraysAsList())
      .createTestSuite();
}
项目:incubator-netbeans    文件:hgStableTest.java   
public static Test suite() {
        if (hgExistsChecker.check(false)) {
            return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
                    .addTest(InitializeTest.class, "testInitializeAndFirstCommit")
                    .addTest(CommitDataTest.class, "testCommitFile", "testRecognizeMimeType")
//                    .addTest(CommitUiTest.class, "testInvokeCloseCommit")
                    .addTest(IgnoreTest.class, "testIgnoreUnignoreFile")
//                    .addTest(DeleteUpdateTest.class, "testDeleteUpdate")
                    .addTest(AnnotationsTest.class, "testShowAnnotations")
                    .addTest(HgPropertiesTest.class, "testHgPropertiesTest")
                    .addTest(CloneTest.class, "testCloneProject")
                    .enableModules(".*")
                    .clusters(".*"));
        } else {
            return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
        }
    }
项目:marathonv5    文件:TestRunner.java   
public Result doRun(Test suite, boolean wait) {
    MarathonTestRunner runner = new MarathonTestRunner();
    runReportDir = argProcessor.getReportDir();
    String resultsDir = new File(runReportDir, "results").getAbsolutePath();
    if (runReportDir != null) {
        System.setProperty(Constants.PROP_REPORT_DIR, runReportDir);
        System.setProperty(Constants.PROP_IMAGE_CAPTURE_DIR, runReportDir);
        System.setProperty("allure.results.directory", resultsDir);
        runner.addListener(new AllureMarathonRunListener());
    }
    runner.addListener(new TextListener(System.out));
    Result result = runSuite(suite, runner);
    MarathonTestCase.reset();
    if (runReportDir != null && !argProcessor.isSkipreports()) {
        AllureUtils.launchAllure(false, resultsDir, new File(runReportDir, "reports").getAbsolutePath());
    }
    return result;
}
项目:guava-mock    文件:Collections2Test.java   
@GwtIncompatible // suite
private static Test testsForFilter() {
  return CollectionTestSuiteBuilder.using(
      new TestStringCollectionGenerator() {
        @Override public Collection<String> create(String[] elements) {
          List<String> unfiltered = newArrayList();
          unfiltered.add("yyy");
          Collections.addAll(unfiltered, elements);
          unfiltered.add("zzz");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
项目:guava-mock    文件:TestsForSetsInJavaUtil.java   
public Test testsForSingletonSet() {
  return SetTestSuiteBuilder.using(
          new TestStringSetGenerator() {
            @Override
            public Set<String> create(String[] elements) {
              return Collections.singleton(elements[0]);
            }
          })
      .named("singleton")
      .withFeatures(
          CollectionFeature.SERIALIZABLE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ONE)
      .suppressing(suppressForSingletonSet())
      .createTestSuite();
}
项目:incubator-netbeans    文件:WatchesTestSuite.java   
public static Test suite() {
//        String os = System.getProperty("os.name");
//        String jdk = System.getProperty("java.version");
//        if ( jdk.contains("1.5") && os.contains("Windows") && !os.contains("Vista") ) {
//            return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
//        } else {
            return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
                .addTest(WatchesTest.class,
                    "testWatchesPublicVariables",
                    "testWatchesProtectedVariables",
                    "testWatchesPrivateVariables",
                    "testWatchesPackagePrivateVariables",
                    "testWatchesFiltersBasic",
                    "testWatchesFiltersLinkedList",
                    "testWatchesFiltersArrayList",
                    "testWatchesFiltersVector",
                    "testWatchesFiltersHashMap",
                    "testWatchesFiltersHashtable",
                    "testWatchesFiltersTreeMap",
                    "testWatchesFiltersTreeSet",
                    "testWatchesFilters1DArray",
                    "testWatchesFilters2DArray",
                    "testWatchesValues").enableModules(".*").clusters(".*"));
//        }
    }
项目:incubator-netbeans    文件:Breakpoints_MethodTestSuite.java   
public static Test suite() {
//        String os = System.getProperty("os.name");
//        String jdk = System.getProperty("java.version");
//        if ( jdk.contains("1.5") && os.contains("Windows") && !os.contains("Vista") ) {
//            return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
//        } else {
            return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
                .addTest(MethodBreakpointsTest.class,
                    "testMethodBreakpointCreation",
                    "testMethodBreakpointPrefilledConstructor",
                    "testMethodBreakpointPrefilledMethod",
                    "testMethodBreakpointCreation",
                    "testMethodBreakpointFunctionalityInPrimaryClass",
                    "testMethodBreakpointFunctionalityInSecondClass",
                    "testMethodBreakpointFunctionalityOnAllMethods",
                    "testMethodBreakpointFunctionalityOnExit",
                    "testConditionalMethodBreakpointFunctionality",
                    "testMethodBreakpointsValidation"
                )
            .enableModules(".*").clusters(".*"));
//        }
    }
项目:marathonv5    文件:TestCreator.java   
public Test getGroup(GroupType type, String groupName) throws IOException {
    File file = getGroupFile(type, groupName);
    if (file == null) {
        return null;
    }
    TestSuite testSuite = getTest(Group.findByFile(type, file.toPath()));
    return testSuite;
}
项目:incubator-netbeans    文件:NbModuleSuiteTest.java   
public void testAccessToInsaneAndFSWithAllModulesEnumerated() {
    System.setProperty("ins.one", "no");
    System.setProperty("ins.fs", "no");

    Test instance = NbModuleSuite.createConfiguration(NbModuleSuiteIns.class).
            gui(false).clusters(".*").enableModules(".*").addTest("testFS").suite();
    junit.textui.TestRunner.run(instance);

    assertProperty("ins.one", "no");
    assertProperty("ins.fs", "OK");
}
项目:incubator-netbeans    文件:svnPropertiesTestSuite.java   
/**
 * Simple method uniting together all the different tests under subversion
 * tests-qa-functional
 */
public static Test suite() {
    if (svnExistsChecker.check(false)) {
        return NbModuleSuite.create(NbModuleSuite.emptyConfiguration()
                .addTest(SvnPropertiesTest.class, "propTest")
                .enableModules(".*").clusters(".*"));
    } else {
        return NbModuleSuite.create(NbModuleSuite.emptyConfiguration());
    }
}
项目:incubator-netbeans    文件:NbModuleSuiteOrderTest.java   
public void testStaticOrder(){
    System.setProperty("order", "1");
    String[] methods = new String[]{"testTwo", "testOne"};
    Test instance = NbModuleSuite.createConfiguration(TT2.class).clusters(".*").enableModules(".*").gui(false).addTest(methods).suite();
    junit.textui.TestRunner.run(instance);

    NbModuleSuiteTest.assertProperty("t.two", "2");
    NbModuleSuiteTest.assertProperty("t.one", "3");
    NbModuleSuiteTest.assertProperty(TEST_ORDER_COUNTER, "3");
}
项目:incubator-netbeans    文件:IssuetableTestFactory.java   
private static IssuetableTestFactory getFromMap (Test test) {
    LinkedList s = (LinkedList) map.get (test);
    IssuetableTestFactory  retVal;
    try {
        retVal = (IssuetableTestFactory) s.getLast();
    } catch (NoSuchElementException x ) {
        System.out.println("exc: "+ test + " : " );
        throw x;
    }
    return retVal;
}
项目:incubator-netbeans    文件:NbModuleSuiteTest.java   
public void testAccessExtraDefinedAutoload() {
    System.setProperty("en.one", "No");

    NbModuleSuite.Configuration config = NbModuleSuite.Configuration.create(AskForOrgOpenideUtilEnumClass.class);
    NbModuleSuite.Configuration addEnum = config.enableModules("org.openide.util.enumerations");
    Test instance = addEnum.gui(false).suite();
    junit.textui.TestRunner.run(instance);

    assertEquals("OK", System.getProperty("en.one"));
}
项目:incubator-netbeans    文件:CachingAndExternalURLTest.java   
public static Test suite() throws IOException {
    return CachingAndExternalPathsTest.create(new CachingAndExternalPathsTest.SetExtDirProperty() {
        public void setExtDirProperty(File value) {
            System.setProperty("ext.dir", Utilities.toURI(value).toString());
        }
    });
}
项目:incubator-netbeans    文件:DiffTest.java   
public static Test suite() {
    return NbModuleSuite.create(NbModuleSuite.createConfiguration(DiffTest.class)
            .addTest("testDiffFile")
            .enableModules(".*")
            .clusters(".*")
    );
}
项目:incubator-netbeans    文件:NetigsoLayerTest.java   
public static Test suite() {
        Test t = null;
//        t = new NetigsoTest("testOSGiCanRequireBundleOnNetBeans");
        if (t == null) {
            t = new NbTestSuite(NetigsoLayerTest.class);
        }
        return t;
    }
项目:vogar    文件:Junit3.java   
public static boolean isJunit3Test(Class<?> klass) {
    // public class FooTest extends TestCase {...}
    //   or
    // public class FooSuite {
    //    public static Test suite() {...}
    // }
    return (TestCase.class.isAssignableFrom(klass) && !Modifier.isAbstract(klass.getModifiers()))
            || new ClassAnalyzer(klass).hasMethod(true, Test.class, "suite");
}
项目:incubator-netbeans    文件:BasicTest.java   
public static Test suite() {
    return NbModuleSuite.create(
        NbModuleSuite.createConfiguration(BasicTest.class).addTest(
        "testBasic",
        "testBasicCPU",
        "testBasicMemory",
        "testCascadeThreads",
        "testCascadeThreadsCPU",
        "testCascadeThreadsMemory").enableModules(".*").clusters(".*").gui(false));
}
项目:googles-monorepo-demo    文件:TestsForSetsInJavaUtil.java   
public Test testsForAbstractSet() {
  return SetTestSuiteBuilder.using(
          new TestStringSetGenerator() {
            @Override
            protected Set<String> create(String[] elements) {
              final String[] deduped = dedupe(elements);
              return new AbstractSet<String>() {
                @Override
                public int size() {
                  return deduped.length;
                }

                @Override
                public Iterator<String> iterator() {
                  return MinimalCollection.of(deduped).iterator();
                }
              };
            }
          })
      .named("AbstractSet")
      .withFeatures(
          CollectionFeature.NONE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER, // in this case, anyway
          CollectionSize.ANY)
      .suppressing(suppressForAbstractSet())
      .createTestSuite();
}
项目:incubator-netbeans    文件:BasicTest.java   
public static Test suite() {
    return NbModuleSuite.create(NbModuleSuite.createConfiguration(BasicTest.class).addTest(
           "testBasicIndentation",
           "testAdvancedIndentation",
           "testReformat",
           "testReformat2"
           ).clusters(".*").enableModules(".*").gui(true));

}
项目:incubator-netbeans    文件:HTMLNodeTest.java   
/** method used for explicit testsuite definition
 */
public static Test suite() {
    return createModuleTest(HTMLNodeTest.class, tests);
}
项目:jaffa-framework    文件:RawTest.java   
/** Assembles and returns a test suite containing all known tests.
 * @return A test suite.
 */
public static Test suite() {
    return new Wrapper(new TestSuite(RawTest.class));
}
项目:incubator-netbeans    文件:PatternsTest.java   
public static Test suite() {
    return NbModuleSuite.create(
            NbModuleSuite.createConfiguration(PatternsTest.class)
            .enableModules(".*")
            .clusters(".*"));
}
项目:incubator-netbeans    文件:NewFileWizardOperatorTest.java   
/** Method used for explicit testsuite definition
 * @return  created suite
 */
public static Test suite() {
    return createModuleTest(NewFileWizardOperatorTest.class,
            tests);
}
项目:ConfigCenter    文件:AppTest.java   
/**
 * @return the suite of tests being tested
 */
public static Test suite()
{
    return new TestSuite( AppTest.class );
}
项目:jaffa-framework    文件:StoredProcedureTest.java   
/** Assembles and returns a test suite containing all known tests.
 * @return A test suite.
 */
public static Test suite() {
    return new Wrapper(new TestSuite(StoredProcedureTest.class));
}
项目:incubator-netbeans    文件:QuickSearchTest.java   
public static Test suite() {
    return GraphicsEnvironment.isHeadless() ? new TestSuite() : new TestSuite(QuickSearchTest.class);
}
项目:incubator-netbeans    文件:DiffTest.java   
public static Test suite() {
    return NbModuleSuite.create(
            NbModuleSuite.createConfiguration(DiffTest.class).addTest(
            "testDiffFile"
            ).enableModules(".*").clusters(".*"));
}
项目:hlxy-docker    文件:AppTest.java   
/**
 * @return the suite of tests being tested
 */
public static Test suite()
{
    return new TestSuite( AppTest.class );
}
项目:incubator-netbeans    文件:ThreadBreakpointTest.java   
public static Test suite() {
    return JPDASupport.createTestSuite(ThreadBreakpointTest.class);
}
项目:myfaces-trinidad    文件:HtmlFrameBorderLayoutTest.java   
public static Test suite()
{
  return new TestSuite(HtmlFrameBorderLayoutTest.class);
}
项目:lib-commons-httpclient    文件:TestCookieVersionSupport.java   
public static Test suite() {
    return new TestSuite(TestCookieVersionSupport.class);
}
项目:openjdk-jdk10    文件:EntryTest.java   
public static Test suite() {
    return new TestSuite(EntryTest.class);
}
项目:incubator-netbeans    文件:SmartCCTests.java   
public static Test suite() {
    return NbModuleSuite.create(
            NbModuleSuite.createConfiguration(SmartCCTests.class).enableModules(".*").clusters(".*"));
}