-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactors package structure and adds more java doc
- Loading branch information
1 parent
9d267b6
commit 0d7d30d
Showing
8 changed files
with
75 additions
and
32 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
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
11 changes: 9 additions & 2 deletions
11
test-utils/src/main/java/io/littlehorse/test/CapturedResult.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 |
---|---|---|
@@ -1,10 +1,17 @@ | ||
package io.littlehorse.test; | ||
|
||
import io.littlehorse.test.internal.step.VerifyTaskRunOutputsStep; | ||
|
||
/** | ||
* {@code CapturedResult} is a wrapper for a response. see {@link VerifyTaskRunOutputsStep.SearchResultCaptor} | ||
* @param <T> Search response type | ||
*/ | ||
public interface CapturedResult<T> { | ||
|
||
/** | ||
* Returns the search response value | ||
*/ | ||
T get(); | ||
|
||
void set(T result); | ||
|
||
Class<T> type(); | ||
} |
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
30 changes: 30 additions & 0 deletions
30
test-utils/src/main/java/io/littlehorse/test/internal/step/CapturedResultImpl.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,30 @@ | ||
package io.littlehorse.test.internal.step; | ||
|
||
import io.littlehorse.test.CapturedResult; | ||
|
||
class CapturedResultImpl<T> implements CapturedResult<T> { | ||
|
||
private T value; | ||
private final Class<T> target; | ||
|
||
public CapturedResultImpl(Class<T> target) { | ||
this.target = target; | ||
} | ||
|
||
@Override | ||
public T get() { | ||
return value; | ||
} | ||
|
||
public void set(T result) { | ||
if (value != null) { | ||
throw new IllegalStateException("Already has value"); | ||
} | ||
value = result; | ||
} | ||
|
||
@Override | ||
public Class<T> type() { | ||
return target; | ||
} | ||
} |
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