File tree Expand file tree Collapse file tree
drive/snippets/drive_v2/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public class FetchAppDataFolder {
3838 * Fetches appDataFolder and prints it's folder id.
3939 * @return Application data folder's ID.
4040 */
41- public String fetchAppDataFolder () throws IOException {
41+ public static String fetchAppDataFolder () throws IOException {
4242 /*Load pre-authorized user credentials from the environment.
4343 TODO(developer) - See https://developers.google.com/identity for
4444 guides on implementing OAuth2 for your application.*/
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public class ListAppData {
3838 * list down files in the application data folder.
3939 * @return list of 10 files.
4040 */
41- public FileList listAppData () throws IOException {
41+ public static FileList listAppData () throws IOException {
4242 /*Load pre-authorized user credentials from the environment.
4343 TODO(developer) - See https://developers.google.com/identity for
4444 guides on implementing OAuth2 for your application.*/
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public class UploadAppData {
3737 * Creates a file in the application data folder.
3838 * @return Created file's Id.
3939 */
40- private static String uploadAppData () throws IOException {
40+ public static String uploadAppData () throws IOException {
4141 /*Load pre-authorized user credentials from the environment.
4242 TODO(developer) - See https://developers.google.com/identity for
4343 guides on implementing OAuth2 for your application.*/
Original file line number Diff line number Diff line change 1+ // Copyright 2022 Google LLC
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // https://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ import org .junit .Test ;
16+
17+ import java .io .IOException ;
18+ import java .security .GeneralSecurityException ;
19+
20+ import static org .junit .Assert .assertNotNull ;
21+
22+ // Unit test class for testing of FetchAppDataFolder snippet
23+ public class TestFetchAppdataFolder {
24+ @ Test
25+ public void fetchAppDataFolder () throws IOException , GeneralSecurityException {
26+ String id = FetchAppDataFolder .fetchAppDataFolder ();
27+ assertNotNull (id );
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2022 Google LLC
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // https://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ import com .google .api .services .drive .model .FileList ;
16+ import org .junit .Test ;
17+
18+ import java .io .IOException ;
19+ import java .security .GeneralSecurityException ;
20+
21+ import static org .junit .Assert .assertNotEquals ;
22+
23+ // Unit test class for testing of ListAppData snippet
24+ public class TestListAppdata extends BaseTest {
25+ @ Test
26+ public void listAppData () throws IOException , GeneralSecurityException {
27+ String id = UploadAppData .uploadAppData ();
28+ deleteFileOnCleanup (id );
29+ FileList files = ListAppData .listAppData ();
30+ assertNotEquals (0 , files .getItems ().size ());
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ // Copyright 2022 Google LLC
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // https://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ import org .junit .Test ;
16+
17+ import java .io .IOException ;
18+ import java .security .GeneralSecurityException ;
19+
20+ import static org .junit .Assert .assertNotNull ;
21+
22+ // Unit test class for testing of UploadAppData snippet
23+ public class TestUploadAppdata extends BaseTest {
24+ @ Test
25+ public void uploadAppData ()
26+ throws IOException , GeneralSecurityException {
27+ String id = UploadAppData .uploadAppData ();
28+ assertNotNull (id );
29+ deleteFileOnCleanup (id );
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments