Closed dmfs closed 11 months ago
implementation idea: change the interface to something like this
public interface Resource<T>
{
T value(User user);
void close(User user) throws Exception;
}
where User
is a type that identifies an Assertion decorator (WithResource
) or another Resource that uses the given resource. A Resource would be closed when all Users have closed it. This would prevent eager usage (because you can't provide a reasonable User) and enable test class instantiation without creating test resources at the same time.
At present it may happen that a resource is closed before its derived resources are closed. In most cases this is not an issue, but there may be cases when this could become an issue.