Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Conversation

@rockytriton
Copy link
Contributor

Not sure if I'm doing this pull request right, first time. Anyway, added support for getRootUrl() to the Rest annotation.

@DayS
Copy link
Contributor

DayS commented May 24, 2013

You also have to :

  • update functional test to check if everything compiles with this feature
  • add unit tests in AA core to check the validator is working fine. You can do it like this :

AndroidAnnotations/androidannotations/src/test/java/org/androidannotations/rest/RestTest.java :

@Test
public void client_with_wrong_enhanced_methods() throws IOException {
    CompileResult result = compileFiles(ClientWithWrongEnhancedMethod.class);
    assertCompilationErrorOn(ClientWithWrongEnhancedMethod.class, "Object getRestTemplate();", result);
    assertCompilationErrorOn(ClientWithWrongEnhancedMethod.class, "String getURL();", result);
    assertCompilationErrorOn(ClientWithWrongEnhancedMethod.class, "String getRootURL();", result);
    assertCompilationErrorOn(ClientWithWrongEnhancedMethod.class, "String getRootURL(String param);", result);
    assertCompilationErrorOn(ClientWithWrongEnhancedMethod.class, "boolean setRootURL();", result);
    assertCompilationErrorCount(5, result);
}

AndroidAnnotations/androidannotations/src/test/java/org/androidannotations/rest/ClientWithWrongEnhancedMethod.java :

@Rest(converters = { MappingJacksonHttpMessageConverter.class })
public interface ClientWithWrongEnhancedMethod {
    // Correct
    RestTemplate getTemplate();
    String getRootUrl();

    // Wrong
    Object getRestTemplate();
    String getURL();
    String getRootURL();
    String getRootURL(String param);
    boolean setRootURL();
}

@rockytriton
Copy link
Contributor Author

I think I fixed all of these issues, let me know what you think

@DayS
Copy link
Contributor

DayS commented May 26, 2013

Just add a String getRootUrl(); method in org.androidannotations.test15.rest.MyService class of functional-tests project and it'll be fine to me

It directly shows that it compiles fine. The unit tests in AA core is just to check that validator is working fine and throws an error

@rockytriton
Copy link
Contributor Author

ok got it

DayS added a commit that referenced this pull request May 27, 2013
@DayS DayS merged commit 14d5840 into androidannotations:develop May 27, 2013
@DayS
Copy link
Contributor

DayS commented May 27, 2013

Related to #599

@DayS
Copy link
Contributor

DayS commented May 27, 2013

Thanks for the feature 👍

@rockytriton rockytriton deleted the 599_getRootUrl_Support branch May 27, 2013 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants