package cz.xtf.core.openshift.helpers;

import io.fabric8.kubernetes.api.model.Pod;

import java.util.List;
import java.util.function.Function;

public class ResourceFunctions {

	public static Function<List<Pod>, Boolean> areExactlyNPodsReady(int n) {
		return pods -> pods.size() == n && pods.stream().allMatch(ResourceParsers::isPodReady);
	}

	public static Function<List<Pod>, Boolean> areExactlyNPodsRunning(int n) {
		return pods -> pods.size() == n && pods.stream().allMatch(ResourceParsers::isPodRunning);
	}

	public static Function<List<Pod>, Boolean> haveAnyPodRestarted() {
		return haveAnyPodRestartedAtLeastNTimes(1);
	}

	public static Function<List<Pod>, Boolean> haveAnyPodRestartedAtLeastNTimes(int n) {
		return pods -> pods.stream().anyMatch(pod -> ResourceParsers.hasPodRestartedAtLeastNTimes(pod, n));
	}

	private ResourceFunctions() {

	}
}

@@ -443,44 +443,22 @@
 ds.s
-ize() == n && pods.stream().allMatch
+tream().filter
 (Res
@@ -484,16 +484,29 @@
 Running)
+.count() == n
 ;%0A%09%7D%0A%0A%09p

Fix areExactlyNPodsRunning ResourceParser