-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/java/org/gridsuite/ds/server/controller/utils/TestUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2023, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.gridsuite.ds.server.controller.utils; | ||
|
||
import org.springframework.cloud.stream.binder.test.OutputDestination; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.Assert.assertNull; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
public final class TestUtils { | ||
private static final long TIMEOUT = 100; | ||
|
||
private TestUtils() { | ||
|
||
} | ||
|
||
public static void assertQueuesEmptyThenClear(List<String> destinations, OutputDestination output) throws InterruptedException { | ||
Thread.sleep(TIMEOUT); | ||
try { | ||
destinations.forEach(destination -> assertNull("Should not be any messages in queue " + destination + " : ", output.receive(0, destination))); | ||
} catch (NullPointerException e) { | ||
// Ignoring | ||
} finally { | ||
output.clear(); // purge in order to not fail the other tests | ||
} | ||
} | ||
} |