@Test
  public void testCreateEndpoint() throws Exception {
    Project project = getProject();
    JavaClass entity = generateEntity(project, null, "User");
    assertFalse(entity.hasAnnotation(XmlRootElement.class));

    setupRest();

    queueInputLines("");
    getShell().execute("rest endpoint-from-entity");

    JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
    JavaResource resource = java.getJavaResource(java.getBasePackage() + ".rest.UserEndpoint");
    JavaClass endpoint = (JavaClass) resource.getJavaSource();

    assertEquals("/user", endpoint.getAnnotation(Path.class).getStringValue());
    assertEquals("java.util.List", endpoint.getMethod("listAll").getQualifiedReturnType());
    Method<JavaClass> method = endpoint.getMethod("findById", Long.class);
    Type<JavaClass> returnTypeInspector = method.getReturnTypeInspector();
    assertEquals(
        "com.test." + PersistenceFacetImpl.DEFAULT_ENTITY_PACKAGE + ".User",
        returnTypeInspector.getQualifiedName());

    assertTrue(java.getJavaResource(entity).getJavaSource().hasAnnotation(XmlRootElement.class));
    getShell().execute("build");
  }