File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
databricks-sdk-java/src/test/java/com/databricks/sdk/service/apps Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .databricks .sdk .service .apps ;
2+
3+ import com .databricks .sdk .core .ApiClient ;
4+ import static org .mockito .ArgumentMatchers .*;
5+ import com .databricks .sdk .core .http .Request ;
6+ import org .junit .jupiter .api .Test ;
7+ import org .mockito .Mockito ;
8+
9+ import java .io .IOException ;
10+
11+ import static org .mockito .ArgumentMatchers .*;
12+ import static org .mockito .Mockito .verify ;
13+ import static org .mockito .Mockito .when ;
14+
15+ public class AppsImplTest {
16+ @ Test
17+ public void testCreateAppIncludesNoComputeParameter () throws IOException {
18+ ApiClient apiClient = Mockito .mock (ApiClient .class );
19+ String expectedPath = "/api/2.0/apps" ;
20+ when (apiClient .execute (any (), any ())).thenReturn (null );
21+ when (apiClient .serialize (any ())).thenReturn ("" );
22+
23+ AppsService apps = new AppsImpl (apiClient );
24+ apps .create (new CreateAppRequest ().setNoCompute (true ));
25+
26+ verify (apiClient )
27+ .execute (
28+ argThat (
29+ (Request req ) -> {
30+ if (!req .getMethod ().equals ("POST" )) {
31+ return false ;
32+ }
33+ if (!req .getUrl ().equals (expectedPath )) {
34+ return false ;
35+ }
36+ if (!req .getQuery ().containsKey ("no_compute" )) {
37+ return false ;
38+ }
39+ if (!req .getQuery ().get ("no_compute" ).get (0 ).equals ("true" )) {
40+ return false ;
41+ }
42+ return true ;
43+ }),
44+ eq (App .class ));
45+ }
46+ }
You can’t perform that action at this time.
0 commit comments