Skip to content

Commit 4d13440

Browse files
committed
udpated test cases
1 parent 81d3dc8 commit 4d13440

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

src/main/java/com/auth0/client/mgmt/PromptsEntity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ public Request<Prompt> getPrompt() {
3434
}
3535

3636
/**
37-
* Get the prompt.
37+
* Update the prompt.
3838
* A token with {@code update:prompts} scope is required.
39+
* @param prompt the prompt to update.
3940
* @return a Request to execute.
4041
*
4142
* @see <a href="https://auth0.com/docs/api/management/v2#!/prompts/patch-prompts">https://auth0.com/docs/api/management/v2#!/prompts/patch-prompts</a>

src/test/java/com/auth0/client/MockServer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public class MockServer {
8686
public static final String MGMT_RECOVERY_CODE = "src/test/resources/mgmt/recovery_code.json";
8787
public static final String MGMT_IDENTITIES_LIST = "src/test/resources/mgmt/identities_list.json";
8888
public static final String MGMT_PROMPT = "src/test/resources/mgmt/prompt.json";
89+
public static final String MGMT_CUSTOM_TEXT_PROMPT = "src/test/resources/mgmt/custom_text_prompt.json";
8990
public static final String MGMT_PARTIALS_PROMPT = "src/test/resources/mgmt/partials_prompt.json";
9091
public static final String MGMT_GUARDIAN_AUTHENTICATION_POLICIES_LIST = "src/test/resources/mgmt/guardian_authentication_policies_list.json";
9192
public static final String MGMT_GUARDIAN_ENROLLMENT = "src/test/resources/mgmt/guardian_enrollment.json";

src/test/java/com/auth0/client/mgmt/PromptsEntityTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import java.util.HashMap;
1010
import java.util.Map;
1111

12-
import static com.auth0.client.MockServer.MGMT_PARTIALS_PROMPT;
13-
import static com.auth0.client.MockServer.MGMT_PROMPT;
12+
import static com.auth0.client.MockServer.*;
1413
import static com.auth0.client.RecordedRequestMatcher.hasHeader;
1514
import static com.auth0.client.RecordedRequestMatcher.hasMethodAndPath;
1615
import static org.hamcrest.MatcherAssert.assertThat;
@@ -86,7 +85,7 @@ public void shouldGetCustomText() throws Exception {
8685
Request<Object> request = api.prompts().getCustomText("login", "en");
8786
assertThat(request, is(notNullValue()));
8887

89-
server.jsonResponse(MGMT_PARTIALS_PROMPT, 200);
88+
server.jsonResponse(MGMT_CUSTOM_TEXT_PROMPT, 200);
9089
Object response = request.execute().getBody();
9190
RecordedRequest recordedRequest = server.takeRequest();
9291

@@ -120,11 +119,16 @@ public void shouldThrowOnSetCustomTextWhenCustomTextIsNull() throws Exception {
120119

121120
@Test
122121
public void shouldSetCustomText() throws Exception {
122+
Map<String, String> signup = new HashMap<>();
123+
signup.put("description", "Sign up to access amazing features for my login domain");
124+
123125
Map<String, Object> customText = new HashMap<>();
126+
customText.put("signup", signup);
127+
124128
Request<Void> request = api.prompts().setCustomText("login", "en", customText);
125129
assertThat(request, is(notNullValue()));
126130

127-
server.jsonResponse(MGMT_PARTIALS_PROMPT, 200);
131+
server.jsonResponse(MGMT_CUSTOM_TEXT_PROMPT, 200);
128132
request.execute();
129133
RecordedRequest recordedRequest = server.takeRequest();
130134

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"signup": {
3+
"description": "Sign up to access amazing features for my login domain"
4+
}
5+
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
{
2-
"login": {
3-
"description": "Login to ACME's Website"
4-
}
52
}

0 commit comments

Comments
 (0)