From a7e87d39b60cbb0a107440ce59bda03ce5dfc69e Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Tue, 1 Aug 2023 19:07:47 -0500 Subject: [PATCH] Fix failing test --- .../server/controller/StreamControllerTests.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/StreamControllerTests.java b/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/StreamControllerTests.java index 617d99f0a2..4dbb6327b4 100644 --- a/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/StreamControllerTests.java +++ b/spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/StreamControllerTests.java @@ -1052,7 +1052,7 @@ public void testDuplicateDeployWhenStreamIsBeingDeployed() throws Exception { @Test public void testUndeployNonDeployedStream() throws Exception { - when(skipperClient.search(eq("myStream"), eq(false))).thenReturn(Arrays.asList(new PackageMetadata())); + when(skipperClient.search(eq("myStream"), eq(false))).thenReturn(Arrays.asList(newPackageMetadata("myStream"))); repository.save(new StreamDefinition("myStream", "time | log")); mockMvc.perform(delete("/streams/deployments/myStream") @@ -1071,8 +1071,8 @@ public void testUndeployNonDeployedStream() throws Exception { @Test public void testUndeployAllNonDeployedStream() throws Exception { - when(skipperClient.search(eq("myStream1"), eq(false))).thenReturn(Arrays.asList(new PackageMetadata())); - when(skipperClient.search(eq("myStream2"), eq(false))).thenReturn(Arrays.asList(new PackageMetadata())); + when(skipperClient.search(eq("myStream1"), eq(false))).thenReturn(Arrays.asList(newPackageMetadata("myStream1"))); + when(skipperClient.search(eq("myStream2"), eq(false))).thenReturn(Arrays.asList(newPackageMetadata("myStream2"))); repository.save(new StreamDefinition("myStream1", "time | log")); repository.save(new StreamDefinition("myStream2", "time | log")); @@ -1092,6 +1092,13 @@ public void testUndeployAllNonDeployedStream() throws Exception { assertThat(auditRecords.get(5).getAuditAction()).isEqualTo(AuditActionType.UNDEPLOY); } + private PackageMetadata newPackageMetadata(String streamName) { + PackageMetadata packageMetadata = new PackageMetadata(); + packageMetadata.setName(streamName); + return packageMetadata; + } + + @Test public void testDeployWithProperties() throws Exception { repository.save(new StreamDefinition("myStream", "time | log"));