org.etlunit.feature.FeatureStatusReporterProxy Maven / Gradle / Ivy
package org.etlunit.feature;
import org.etlunit.StatusReporter;
import org.etlunit.parser.ETLTestClass;
import org.etlunit.parser.ETLTestMethod;
import java.util.ArrayList;
import java.util.List;
public class FeatureStatusReporterProxy implements StatusReporter
{
private final List reporters = new ArrayList();
public FeatureStatusReporterProxy(List features)
{
for (Feature feature : features)
{
StatusReporter direct = feature.getStatusReporter();
if (direct != null)
{
reporters.add(direct);
}
}
}
@Override
public void scanStarted()
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.scanStarted();
}
});
}
@Override
public void scanCompleted()
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.scanCompleted();
}
});
}
@Override
public void testsStarted(final int numTestsSelected)
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.testsStarted(numTestsSelected);
}
});
}
@Override
public void testClassAccepted(final ETLTestClass method)
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.testClassAccepted(method);
}
});
}
@Override
public void testMethodAccepted(final ETLTestMethod method)
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.testMethodAccepted(method);
}
});
}
@Override
public void testBeginning(final ETLTestMethod method)
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.testBeginning(method);
}
});
}
@Override
public void testCompleted(final ETLTestMethod method, final CompletionStatus status)
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.testCompleted(method, status);
}
});
}
@Override
public void testsCompleted()
{
broadcast(new FeatureReporter()
{
@Override
public void broadcast(StatusReporter director)
{
director.testsCompleted();
}
});
}
private static interface FeatureReporter
{
void broadcast(StatusReporter director);
}
private void broadcast(FeatureReporter dire)
{
boolean ret = false;
for (StatusReporter direct : reporters)
{
dire.broadcast(direct);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy