Codota Logo
ReflectiveMessageValidator.consume
Code IndexAdd Codota to your IDE (free)

How to use
consume
method
in
org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator

Best Java code snippets using org.eclipse.lsp4j.jsonrpc.validation.ReflectiveMessageValidator.consume (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: eclipse/lsp4j

  private void assertIssues(Message message, CharSequence expectedIssues) {
    try {
      validator.consume(message);
      Assert.fail("Expected InvalidMessageException: " + expectedIssues + ".");
    } catch (MessageIssueException e) {
      String expected = expectedIssues.toString();
      String actual = LineEndings.toSystemLineEndings(e.getMessage());
      // The expectation may be a prefix of the actual exception message
      if (!actual.startsWith(expected))
        Assert.assertEquals(expected, actual);
    }
  }
}
origin: eclipse/lsp4j

@Test public void testSkipJsonElement() {
  final AtomicBoolean result = new AtomicBoolean(false);
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator((message) -> {
    result.set(true);
  });
  NotificationMessage message = new NotificationMessage();
  message.setMethod("foo");
  message.setParams(new JsonObject());
  validator.consume(message);
  Assert.assertTrue(result.get());
}

origin: eclipse/lsp4j

@Test public void testRequestValidation() {
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator();
  
  RequestMessage message = new RequestMessage();
  message.setId("1");
  message.setParams(new Object());
  try {
    validator.consume(message);
    Assert.fail();
  } catch (MessageIssueException e) {
    Assert.assertEquals("The accessor 'RequestMessage.getMethod()' must return a non-null value. Path: $.method", e.getMessage());
  }
}

origin: eclipse/lsp4j

@Test public void testNoViolation() {
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator();
  
  NotificationMessage message = new NotificationMessage();
  message.setMethod("foo");
  Foo foo = new Foo();
  foo.nonNullString = "test";
  foo.nested = new Foo() {{
    nonNullString = "something";
  }};
  message.setParams(foo);
  validator.consume(message);
}

origin: eclipse/lsp4j

@Test public void testReflectionOnPropertiesOnly() {
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator();
  
  NotificationMessage message = new NotificationMessage();
  message.setMethod("foo");
  Foo foo = new Foo();
  foo.nonNullString = "test";
  foo.nested = new Foo() {{
    nonNullString = "something";
  }};
  foo.foos = new ArrayList<>();
  foo.foos.add(new Foo());
  message.setParams(foo);
  try {
    validator.consume(message);
    Assert.fail();
  } catch (MessageIssueException e) {
    Assert.assertEquals("The accessor 'Foo.getNonNullString()' must return a non-null value. Path: $.params.foos[0].nonNullString", e.getMessage());
  }
}
origin: eclipse/lsp4j

@Test public void testNonNullViolated() {
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator();
  
  NotificationMessage message = new NotificationMessage();
  message.setMethod("foo");
  message.setParams(new Foo());
  try {
    validator.consume(message);
    Assert.fail();
  } catch (MessageIssueException e) {
    Assert.assertEquals("The accessor 'Foo.getNonNullString()' must return a non-null value. Path: $.params.nonNullString", e.getMessage());
  }
}

origin: eclipse/lsp4j

@Test public void testRecursionViolation() {
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator();
  
  NotificationMessage message = new NotificationMessage();
  message.setMethod("foo");
  Foo foo = new Foo();
  foo.nonNullString = "test";
  foo.nested = foo;
  message.setParams(foo);
  try {
    validator.consume(message);
    Assert.fail();
  } catch (MessageIssueException e) {
    Assert.assertEquals("An element of the message has a direct or indirect reference to itself. Path: $.params.nested", e.getMessage());
  }
}

origin: eclipse/lsp4j

@Test public void testNonNullViolated_nested() {
  ReflectiveMessageValidator validator = new ReflectiveMessageValidator();
  
  NotificationMessage message = new NotificationMessage();
  message.setMethod("foo");
  Foo foo = new Foo();
  foo.nonNullString = "test";
  foo.nested = new Foo();
  message.setParams(foo);
  try {
    validator.consume(message);
    Assert.fail();
  } catch (MessageIssueException e) {
    Assert.assertEquals("The accessor 'Foo.getNonNullString()' must return a non-null value. Path: $.params.nested.nonNullString", e.getMessage());
  }
}

org.eclipse.lsp4j.jsonrpc.validationReflectiveMessageValidatorconsume

Popular methods of ReflectiveMessageValidator

  • <init>
    Forward messages to the given consumer unless an issue is found.
  • createPathString
  • getPropertyName
  • isGetter
  • validate
    Validate all fields of the given object.

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now