All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.assertj.swing.junit.ant.TestCollection Maven / Gradle / Ivy

There is a newer version: 3.17.1
Show newest version
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * Copyright 2012-2018 the original author or authors.
 */
package org.assertj.swing.junit.ant;

import static java.lang.System.currentTimeMillis;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

import junit.framework.Test;

import org.assertj.swing.junit.xml.XmlNode;

/**
 * Understands a collection of executed tests in a suite.
 * 
 * @author Alex Ruiz
 */
class TestCollection {

  final Map testXml = new ConcurrentHashMap();
  final List failed = new CopyOnWriteArrayList();
  final Map started = new ConcurrentHashMap();

  void started(Test test) {
    started.put(test, currentTimeMillis());
  }

  boolean wasStarted(Test test) {
    return started.containsKey(test);
  }

  long startTimeOf(Test test) {
    return started.get(test);
  }

  void addXmlNode(Test test, XmlNode n) {
    testXml.put(test, n);
  }

  XmlNode xmlNodeFor(Test test) {
    return testXml.get(test);
  }

  boolean wasFailed(Test test) {
    return failed.contains(test);
  }

  void failed(Test test) {
    failed.add(test);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy