Skip to content

Commit

Permalink
Update WorkflowTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
yarinkos authored Aug 7, 2023
1 parent 60f7858 commit f5e6859
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.javaoperatorsdk.operator.sample.simple.TestCustomResource;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
Expand All @@ -24,6 +25,22 @@ class WorkflowTest {

ExecutorService executorService = Executors.newCachedThreadPool();

@Test
void zeroTopLevelDRShouldThrowException() {
var dr1 = mock(DependentResource.class);
var dr2 = mock(DependentResource.class);
var dr3 = mock(DependentResource.class);

var cyclicWorkflowBuilderSetup = new WorkflowBuilder<TestCustomResource>()
.addDependentResource(dr1).dependsOn()
.addDependentResource(dr2).dependsOn(dr1)
.addDependentResource(dr3).dependsOn(dr2)
.addDependentResource(dr1).dependsOn(dr2);

assertThrows(IllegalStateException.class,
cyclicWorkflowBuilderSetup::build);
}

@Test
void calculatesTopLevelResources() {
var dr1 = mock(DependentResource.class);
Expand Down

0 comments on commit f5e6859

Please sign in to comment.