Ejemplo n.º 1
0
 @AfterClass
 public void confirmMultipleThreads() {
   Assert.assertTrue(
       _threads.size() > 1,
       "More than one thread should have been used for running the tests - "
           + _threads.size()
           + " was used");
 }
  @Test
  public void testLoadData() {

    final Set<TestBean> theLoadedBeans = new HashSet<TestBean>();

    this.myDataLoader.loadData(
        new DataConsumer() {

          public void consume(Map<String, Object> aRecord) {

            theLoadedBeans.add(
                new TestBean(
                    (String) aRecord.get(FIRST_NAME_PROP_NAME),
                    (String) aRecord.get(LAST_NAME_PROP_NAME),
                    (String) aRecord.get(FAVORITE_COLOR)));
          }
        });

    assertEquals(theLoadedBeans.size(), this.myExpectedBeans.size());
    assertTrue(
        this.myExpectedBeans.containsAll(theLoadedBeans),
        format("%1$s does not match %2$s", theLoadedBeans, this.myExpectedBeans));
  }