org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys Java Examples

The following examples show how to use org.eclipse.xtext.xbase.formatting2.XbaseFormatterPreferenceKeys. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod01() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def baz() {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #2
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatFor3() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("for (i : 1 .. 2)");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(i)");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #3
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatDoWhile12() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(false));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("do");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("while(true)");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #4
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatDoWhile3() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("do");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("while (true)");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #5
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatDoWhile2() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("do {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("} while (true)");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #6
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatWhile11() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(true));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("while (true)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #7
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatTryCatchExpression11() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(true));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("try");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("catch (Exception e)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"y\")");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #8
Source File: XtendEnumFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatBraces_02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("enum Bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #9
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("class bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def baz()");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #10
Source File: XtendAnnotationTypeFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatBraces_02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("annotation Bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #11
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod01() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("interface bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def baz()");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #12
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("interface bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def baz()");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #13
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod03() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("interface bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("abstract def baz()");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #14
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod04() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("interface bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("public abstract def baz()");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #15
Source File: AnonymousClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatSingleMember() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class Foo {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("val foo = new Runnable() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("override run() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #16
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatTryCatchExpression12() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(false));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("try");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("catch(Exception e)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"y\")");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #17
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructor02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("new()");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #18
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructor01() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("new() {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #19
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatClassSingleAnnotationSL() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("@Deprecated class bar {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("package foo @Deprecated class bar { }");
  _builder_1.newLine();
  this.assertFormatted(_function, _builder, _builder_1);
}
 
Example #20
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatClassSingleAnnotationML1() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #21
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatClassSingleAnnotationML2() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(true));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("package foo @Deprecated class bar { }");
  _builder_1.newLine();
  this.assertFormatted(_function, _builder, _builder_1);
}
 
Example #22
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructorTwoAnnotations1() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterConstructorAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("new() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormattedMember(_function, _builder.toString());
}
 
Example #23
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructorTwoAnnotations2() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterConstructorAnnotations, Boolean.valueOf(true));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("new() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormattedMember(_function, _builder.toString());
}
 
Example #24
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructorTwoAnnotationsSL1() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterConstructorAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override @Deprecated new() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("@Override ");
  _builder_1.newLine();
  _builder_1.append("@Deprecated ");
  _builder_1.newLine();
  _builder_1.append("new() {");
  _builder_1.newLine();
  _builder_1.append("}");
  _builder_1.newLine();
  this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
 
Example #25
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Ignore
@Test
public void formatMethodParameterTwoAnnotations2() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterParameterAnnotations, Boolean.valueOf(true));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("def foo(");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("String p) {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("def foo(  @Override  @Deprecated  String  p  ) {  }");
  _builder_1.newLine();
  this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
 
Example #26
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodParameterTwoAnnotations1() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterParameterAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("def foo(@Override @Deprecated String p) {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("def foo(  @Override  @Deprecated  String  p  ) {  }");
  _builder_1.newLine();
  this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
 
Example #27
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodTwoAnnotations4() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override @Deprecated def foo() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("@Override  ");
  _builder_1.newLine();
  _builder_1.append("@Deprecated  ");
  _builder_1.newLine();
  _builder_1.append("def foo() {  }");
  _builder_1.newLine();
  this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
 
Example #28
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodTwoAnnotations3() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("def foo() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormattedMember(_function, _builder.toString());
}
 
Example #29
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodTwoAnnotations2() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations, Boolean.valueOf(true));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("def foo() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormattedMember(_function, _builder.toString());
}
 
Example #30
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodTwoAnnotations1() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations, Boolean.valueOf(true));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("def foo() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormattedMember(_function, _builder.toString());
}