diff options
author | Oluwatobi Bashir-Bello <nbashirbello@google.com> | 2014-03-31 16:16:16 -0400 |
---|---|---|
committer | Oluwatobi Bashir-Bello <nbashirbello@google.com> | 2014-04-01 11:17:11 -0400 |
commit | 2f1179407be788c7cfd2db1c57e08c5314657d00 (patch) | |
tree | e443427d533577c9d4f9825f348ba39c794502a5 /testData | |
parent | 1bb97024812b4cb3821a1b55c084eb40c8cbf195 (diff) | |
download | cloud-2f1179407be788c7cfd2db1c57e08c5314657d00.tar.gz |
API Method Name Inspection. Checks that all the API method name specfied in @ApiMethod are unique for an Endpoints class.
Change-Id: Ic5edb7a18af05724fd319d508385d4434a0a247e
Diffstat (limited to 'testData')
4 files changed, 109 insertions, 0 deletions
diff --git a/testData/inspections/fullMethodNameInspection/classWithDuplicateFullMethodNames/expected.xml b/testData/inspections/fullMethodNameInspection/classWithDuplicateFullMethodNames/expected.xml new file mode 100644 index 0000000..161c87b --- /dev/null +++ b/testData/inspections/fullMethodNameInspection/classWithDuplicateFullMethodNames/expected.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> + <problem> + <file>test.java</file> + <line>28</line> + <description>Multiple methods with same API method name are prohibited. "boo" is the API method name for function2 and function1.</description> + </problem> +</problems>
\ No newline at end of file diff --git a/testData/inspections/fullMethodNameInspection/classWithDuplicateFullMethodNames/src/test.java b/testData/inspections/fullMethodNameInspection/classWithDuplicateFullMethodNames/src/test.java new file mode 100644 index 0000000..830fb2b --- /dev/null +++ b/testData/inspections/fullMethodNameInspection/classWithDuplicateFullMethodNames/src/test.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; +import com.google.api.server.spi.config.ApiMethod; + +@Api(name="") +public class Foo { + @ApiMethod(name = "boo") + public void function1() { + // do nothing + } + + @ApiMethod(name = "boo") + public void function2() { + // do nothing + } +}
\ No newline at end of file diff --git a/testData/inspections/fullMethodNameInspection/classWithUniqueFullMethodNames/expected.xml b/testData/inspections/fullMethodNameInspection/classWithUniqueFullMethodNames/expected.xml new file mode 100644 index 0000000..c8a109a --- /dev/null +++ b/testData/inspections/fullMethodNameInspection/classWithUniqueFullMethodNames/expected.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> +</problems>
\ No newline at end of file diff --git a/testData/inspections/fullMethodNameInspection/classWithUniqueFullMethodNames/src/test.java b/testData/inspections/fullMethodNameInspection/classWithUniqueFullMethodNames/src/test.java new file mode 100644 index 0000000..8ef538e --- /dev/null +++ b/testData/inspections/fullMethodNameInspection/classWithUniqueFullMethodNames/src/test.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; +import com.google.api.server.spi.config.ApiMethod; + +@Api(name="") +public class Foo { + @ApiMethod(name = "foo") + public void function1() { + // do nothing + } + + @ApiMethod(name = "boo") + public void function2() { + // do nothing + } + + public void foo() { + // do nothing + } +}
\ No newline at end of file |