Java Code Examples for org.eclipse.xtext.xbase.lib.Pair

The following examples show how to use org.eclipse.xtext.xbase.lib.Pair. These examples are extracted from open source projects. 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 Project: n4js   Source File: CommandRebuildTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * The build triggered by the rebuild command must send 'publishDiagnostics' events even for those resources that do
 * not contain any issues, to ensure that any obsolete issues for those resources that might exist on client side
 * are removed. Normally such obsolete issues should not exist (not at start up time, because LSP clients do not
 * serialize issues; and not when rebuild is triggered manually, because an incremental build should have removed
 * those issues); however, in case of bugs in the incremental builder or other special circumstances this may
 * happen.
 */
@Test
public void testPublishDiagnosticsSentForModuleWithoutIssues() {
	testWorkspaceManager.createTestProjectOnDisk(Pair.of("Main", "let x: string = 42; x;"));
	startAndWaitForLspServer();

	assertIssues(Pair.of("Main", Lists.newArrayList(
			"(Error, [0:16 - 0:18], int is not a subtype of string.)")));

	// fix the error on disk, but don't let the LSP server know (to avoid incremental build)
	changeFileOnDiskWithoutNotification("Main", Pair.of("string", "number"));

	// send command under test
	ExecuteCommandParams params = new ExecuteCommandParams(N4JSCommandService.N4JS_REBUILD,
			Collections.emptyList());
	languageServer.executeCommand(params).join();

	// wait for previous command to finish
	joinServerRequests();

	assertNoIssues();
}
 
Example 2
@Test
public void testBug470766_01() {
  boolean _isJava12OrLater = AbstractXtendTestCase.isJava12OrLater();
  if (_isJava12OrLater) {
    Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("void", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("Integer", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_4 = Pair.<String, VarianceInfo>of("Long", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_5 = this.operator_mappedTo(_mappedTo_4, VarianceInfo.INVARIANT);
    this.to(this.merge(_mappedTo_1, _mappedTo_3, _mappedTo_5), "Number & Comparable<?> & Constable & ConstantDesc", VarianceInfo.INVARIANT);
  } else {
    Pair<String, VarianceInfo> _mappedTo_6 = Pair.<String, VarianceInfo>of("void", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_7 = this.operator_mappedTo(_mappedTo_6, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_8 = Pair.<String, VarianceInfo>of("Integer", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_9 = this.operator_mappedTo(_mappedTo_8, VarianceInfo.INVARIANT);
    Pair<String, VarianceInfo> _mappedTo_10 = Pair.<String, VarianceInfo>of("Long", VarianceInfo.OUT);
    Triple<String, VarianceInfo, VarianceInfo> _mappedTo_11 = this.operator_mappedTo(_mappedTo_10, VarianceInfo.INVARIANT);
    this.to(this.merge(_mappedTo_7, _mappedTo_9, _mappedTo_11), "Number & Comparable<?>", VarianceInfo.INVARIANT);
  }
}
 
Example 3
Source Project: lsp4j   Source File: LauncherTest.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testRequest() throws Exception {
	CompletionParams p = new CompletionParams();
	p.setPosition(new Position(1,1));
	p.setTextDocument(new TextDocumentIdentifier("test/foo.txt"));
	
	CompletionList result = new CompletionList();
	result.setIsIncomplete(true);
	result.setItems(new ArrayList<>());
	
	CompletionItem item = new CompletionItem();
	item.setDetail("test");
	item.setDocumentation("doc");
	item.setFilterText("filter");
	item.setInsertText("insert");
	item.setKind(CompletionItemKind.Field);
	result.getItems().add(item);
	
	server.expectedRequests.put("textDocument/completion", new Pair<>(p, result));
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> future = clientLauncher.getRemoteProxy().getTextDocumentService().completion(p);
	Assert.assertEquals(Either.forRight(result).toString(), future.get(TIMEOUT, TimeUnit.MILLISECONDS).toString());
	client.joinOnEmpty();
}
 
Example 4
Source Project: n4js   Source File: ApiImplMapping.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * In {@link #hasErrors() case of error}, returns human-readable error messages. Otherwise, an empty list will be
 * returned.
 */
public List<String> getErrorMessages() {
	final List<String> msgs = new ArrayList<>();
	for (IN4JSProject p : projectsWithUndefImplIds) {
		msgs.add("project '" + p.getProjectName() + "' does not define an ImplementationId in its manifest");
	}
	for (Map.Entry<Pair<N4JSProjectName, N4JSProjectName>, Set<IN4JSProject>> currConflict : conflicts.entrySet()) {
		final N4JSProjectName apiId = currConflict.getKey().getKey();
		final N4JSProjectName implId = currConflict.getKey().getValue();
		final Set<IN4JSProject> culprits = currConflict.getValue();
		final String culpritsStr = " - "
				+ culprits.stream().map(c -> c.getProjectName().getRawName()).collect(Collectors.joining("\n - "));
		msgs.add("several projects define an implementation for API project '" + apiId
				+ "' with implementation ID '" + implId + "':\n" + culpritsStr);
	}
	return msgs;
}
 
Example 5
protected TableViewer createLocationViewer(Composite parent) {
	TableViewer locationViewer = new TableViewer(parent);
	locationViewer.setContentProvider(new ArrayContentProvider());
	locationViewer.setLabelProvider(createLocationLabelProvider());

	TableLayout layout = new TableLayout();
	locationViewer.getTable().setLayout(layout);
	locationViewer.getTable().setHeaderVisible(true);

	Pair<String, ColumnLayoutData>[] locationColumnDescriptions = getLocationColumnDescriptions();
	IntStream.range(0, locationColumnDescriptions.length).forEach(index -> {
		layout.addColumnData(locationColumnDescriptions[index].getValue());
		createColumn(locationViewer.getTable(), locationColumnDescriptions[index], index);
	});

	return locationViewer;
}
 
Example 6
protected void registerMacroAnnotations(final XtendAnnotationTarget candidate, final IAcceptor<Pair<JvmAnnotationType, XAnnotation>> acceptor) {
  final Function1<XAnnotation, Boolean> _function = (XAnnotation it) -> {
    return Boolean.valueOf(this._xAnnotationExtensions.isProcessed(it));
  };
  Iterable<XAnnotation> _filter = IterableExtensions.<XAnnotation>filter(candidate.getAnnotations(), _function);
  for (final XAnnotation annotation : _filter) {
    {
      final JvmAnnotationType activeAnnotationDeclaration = this._xAnnotationExtensions.tryFindAnnotationType(annotation);
      if ((activeAnnotationDeclaration != null)) {
        boolean _isValid = this.isValid(annotation, activeAnnotationDeclaration);
        if (_isValid) {
          Pair<JvmAnnotationType, XAnnotation> _mappedTo = Pair.<JvmAnnotationType, XAnnotation>of(activeAnnotationDeclaration, annotation);
          acceptor.accept(_mappedTo);
        }
      }
    }
  }
}
 
Example 7
Source Project: xtext-core   Source File: ChangeSerializerTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testRenameGlobal1() {
  final InMemoryURIHandler fs = new InMemoryURIHandler();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("#1 root1;");
  Pair<String, String> _mappedTo = Pair.<String, String>of("inmemory:/file1.pstl", _builder.toString());
  this._changeSerializerTestHelper.operator_add(fs, _mappedTo);
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("#1 root2 { ref root1 }");
  Pair<String, String> _mappedTo_1 = Pair.<String, String>of("inmemory:/file2.pstl", _builder_1.toString());
  this._changeSerializerTestHelper.operator_add(fs, _mappedTo_1);
  final ResourceSet rs = this._changeSerializerTestHelper.createResourceSet(fs);
  final Node model = this._changeSerializerTestHelper.<Node>contents(rs, "inmemory:/file1.pstl", Node.class);
  final IChangeSerializer serializer = this._changeSerializerTestHelper.newChangeSerializer();
  final IChangeSerializer.IModification<Resource> _function = (Resource it) -> {
    model.setName("newroot");
  };
  serializer.<Resource>addModification(model.eResource(), _function);
  Assert.assertEquals(1, model.eResource().getResourceSet().getResources().size());
  Collection<IEmfResourceChange> _endRecordChangesToTextDocuments = this._changeSerializerTestHelper.endRecordChangesToTextDocuments(serializer);
  StringConcatenation _builder_2 = new StringConcatenation();
  _builder_2.append("----------------- inmemory:/file1.pstl (syntax: <offset|text>) -----------------");
  _builder_2.newLine();
  _builder_2.append("#1 <3:5|newroot>;");
  _builder_2.newLine();
  _builder_2.append("--------------------------------------------------------------------------------");
  _builder_2.newLine();
  _builder_2.append("3 5 \"root1\" -> \"newroot\"");
  _builder_2.newLine();
  _builder_2.append("----------------- inmemory:/file2.pstl (syntax: <offset|text>) -----------------");
  _builder_2.newLine();
  _builder_2.append("#1 root2 { ref <15:5|newroot> }");
  _builder_2.newLine();
  _builder_2.append("--------------------------------------------------------------------------------");
  _builder_2.newLine();
  _builder_2.append("15 5 \"root1\" -> \"newroot\"");
  _builder_2.newLine();
  this._changeSerializerTestHelper.operator_tripleEquals(_endRecordChangesToTextDocuments, _builder_2);
}
 
Example 8
Source Project: xtext-lib   Source File: MapExtensionsTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void operator_plus_MapPair_1() {
	String v = UUID.randomUUID().toString();
	Map<String, String> o = operator_plus(this.map, new Pair<String, String>("k2", v));
	assertNotNull(o);
	assertNotSame(this.map, o);
	assertEquals(2, this.map.size());
	assertEquals(this.value1, this.map.get("k1"));
	assertEquals(this.value2, this.map.get("k2"));
	assertNull(this.map.get("k3"));
	assertEquals(2, o.size());
	assertEquals(this.value1, o.get("k1"));
	assertEquals(v, o.get("k2"));
	assertNull(o.get("k3"));
}
 
Example 9
@Test
public void testArgumentTypeUsedTwice_08_i() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.IN);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example 10
@Test
public void testNestedUnboundExpectation_02() {
  List<LightweightBoundTypeArgument> _hasHintsFor = this.hasHintsFor(this.in("T", "Iterable<? extends T>", "java.util.List<String>"), "T");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  this.like(_hasHintsFor, _mappedTo_1);
}
 
Example 11
@Test
public void testArgumentTypeUsedTwice_04_f() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.OUT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example 12
Source Project: xtext-xtend   Source File: XtendGenerator.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String reassignThisType(final ITreeAppendable b, final JvmDeclaredType declaredType) {
  String _xblockexpression = null;
  {
    boolean _hasObject = b.hasObject("this");
    if (_hasObject) {
      final Object element = b.getObject("this");
      if ((element instanceof JvmDeclaredType)) {
        boolean _isLocal = ((JvmDeclaredType)element).isLocal();
        if (_isLocal) {
          Pair<String, JvmDeclaredType> _mappedTo = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element));
          boolean _hasName = b.hasName(_mappedTo);
          if (_hasName) {
            Pair<String, JvmDeclaredType> _mappedTo_1 = Pair.<String, JvmDeclaredType>of("this", ((JvmDeclaredType)element));
            b.declareVariable(element, b.getName(_mappedTo_1));
          } else {
            b.declareVariable(element, "");
          }
        } else {
          String _simpleName = ((JvmDeclaredType)element).getSimpleName();
          final String proposedName = (_simpleName + ".this");
          b.declareVariable(element, proposedName);
        }
      }
    }
    String _xifexpression = null;
    if ((declaredType != null)) {
      _xifexpression = b.declareVariable(declaredType, "this");
    }
    _xblockexpression = _xifexpression;
  }
  return _xblockexpression;
}
 
Example 13
public Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> to(final Pair<Map<JvmTypeParameter, List<LightweightBoundTypeArgument>>, LightweightMergedBoundTypeArgument> merged, final String type, final VarianceInfo variance) {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _xblockexpression = null;
  {
    if ((type == null)) {
      Assert.assertNull(merged.getValue());
    } else {
      Assert.assertEquals(type, merged.getValue().getTypeReference().toString());
      Assert.assertEquals(variance, merged.getValue().getVariance());
    }
    _xblockexpression = merged.getKey();
  }
  return _xblockexpression;
}
 
Example 14
@Test
public void testLowerBound_06() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "Iterable<T>", "Iterable<? super String>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}
 
Example 15
@Test
public void testDependsOnOther() {
  List<LightweightBoundTypeArgument> _hasHintsFor = this.hasHintsFor(this.in("T, V", "java.util.Map<T, String>", "java.util.Map<V, Integer>"), "T");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("V", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  this.like(_hasHintsFor, _mappedTo_1);
}
 
Example 16
@Ignore("Substitutions are not applied recursively according to JLS - see ticket 395002")
@Test
public void testBug395002_03() {
  String _selfBound = this.selfBound("$<? extends $<?, A>, ?>");
  String _selfBound_1 = this.selfBound("A extends $<?,A>");
  this.isAssignableFrom(Pair.<String, String>of(_selfBound, _selfBound_1), "A");
}
 
Example 17
@Test
public void testArgumentTypeUsedTwice_06_c() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example 18
Source Project: xtext-xtend   Source File: AssignabilityTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
@Override
public void testFunctionTypeAsParameterized_07() {
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<T, T>", "T extends Integer"), "(Integer)=>Integer");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<? super T, T>", "T extends Integer"), "(Integer)=>Integer");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<T, ? extends T>", "T extends Integer"), "(Integer)=>Integer");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<? super T, ? extends T>", "T extends Integer"), "(Integer)=>Integer");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<T, T>", "T extends Integer"), "(int)=>int");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<? super T, T>", "T extends Integer"), "(int)=>int");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<T, ? extends T>", "T extends Integer"), "(int)=>int");
  this.isNotAssignableFrom(Pair.<String, String>of("$Function1<? super T, ? extends T>", "T extends Integer"), "(int)=>int");
}
 
Example 19
@Test
public void testUnloadedInstallDerivedStateThrowsException() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package foo class ClassA extends bar.ClassB {}");
    Pair<String, String> _mappedTo = Pair.<String, String>of("foo/ClassA.xtend", _builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("package bar class ClassB { public foo.ClassA myField }");
    Pair<String, String> _mappedTo_1 = Pair.<String, String>of("bar/ClassB.xtend", _builder_1.toString());
    final ResourceSet resourceSet = this.compiler.unLoadedResourceSet(_mappedTo, _mappedTo_1);
    final List<? extends Resource> resources = resourceSet.getResources();
    ArrayList<Resource> _arrayList = new ArrayList<Resource>(resources);
    for (final Resource res : _arrayList) {
      {
        Assert.assertFalse(res.isLoaded());
        try {
          ((DerivedStateAwareResource) res).installDerivedState(true);
          Assert.fail("expected exception");
        } catch (final Throwable _t) {
          if (_t instanceof IllegalStateException) {
          } else {
            throw Exceptions.sneakyThrow(_t);
          }
        }
      }
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 20
@Test
public void testArgumentTypeUsedTwice_02_e() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.OUT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example 21
@Test
public void testInheritanceMapping_01() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("E", "Iterable<E>", "java.util.ArrayList<String>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  this.assertMapping(_mappedBy, "E", _mappedTo_1);
}
 
Example 22
/**
 * same as {@link #resourceSet(Pair...)} but without actually loading the created resources.
 */
@SuppressWarnings("unchecked")
public ResourceSet unLoadedResourceSet(Pair<String,? extends CharSequence> ...resources ) throws IOException {
	XtextResourceSet result = resourceSetProvider.get();
	for (Pair<String, ? extends CharSequence> entry : resources) {
		URI uri = copyToWorkspace(getSourceFolderPath()+"/"+entry.getKey(), entry.getValue());
		Resource resource = result.createResource(uri);
		if (resource == null)
			throw new IllegalStateException("Couldn't create resource for URI "+uri+". Resource.Factory not registered?");
	}
	return result;
}
 
Example 23
@Test
public void testLowerBound_02() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "Iterable<? super T>", "Iterable<? super String>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}
 
Example 24
private Pair<String, Image> image(final String id) {
  PluginImageHelper _pluginImageHelper = new PluginImageHelper();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("platform:/plugin/");
  _builder.append(FowlerdslActivator.PLUGIN_ID);
  _builder.append("/");
  _builder.append(id);
  Image _image = _pluginImageHelper.getImage(_builder.toString());
  return Pair.<String, Image>of(id, _image);
}
 
Example 25
@Test
public void testArgumentTypeUsedTwice_07_g() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.IN);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", null);
}
 
Example 26
@Override
public void accept(ContentAssistEntry entry, int priority) {
	if (entry != null) {
		if (entry.getProposal() == null)
			throw new IllegalArgumentException("Proposal must not be null.");
		entries.add(Pair.of(priority, entry));
	}
}
 
Example 27
@Test
public void testUnambiguousMapping_05() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T, T2", "T", "CharSequence", "T2", "CharSequence");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("CharSequence", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.OUT);
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _assertMapping = this.assertMapping(_mappedBy, "T", _mappedTo_1);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("CharSequence", VarianceInfo.OUT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.OUT);
  this.assertMapping(_assertMapping, "T2", _mappedTo_3);
}
 
Example 28
@Test
public void testArgumentTypeUsedTwice_09_c() {
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.IN);
  Pair<String, VarianceInfo> _mappedTo_2 = Pair.<String, VarianceInfo>of("String", VarianceInfo.IN);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_3 = this.operator_mappedTo(_mappedTo_2, VarianceInfo.INVARIANT);
  this.to(this.merge(_mappedTo_1, _mappedTo_3), "String", VarianceInfo.INVARIANT);
}
 
Example 29
Source Project: xtext-lib   Source File: MapExtensionsTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void operator_remove_MapPair_0() {
	String v = UUID.randomUUID().toString();
	boolean o;
	
	o = operator_remove(this.map, new Pair<String, String>("k3", v));
	assertFalse(o);
	assertEquals(2, this.map.size());
	assertEquals(this.value1, this.map.get("k1"));
	assertEquals(this.value2, this.map.get("k2"));
}
 
Example 30
@Test
public void testUpperBound_09() {
  Map<JvmTypeParameter, List<LightweightBoundTypeArgument>> _mappedBy = this.mappedBy("T", "Iterable<? extends Iterable<T>>", "Iterable<? extends Iterable<CharSequence>>");
  Pair<String, VarianceInfo> _mappedTo = Pair.<String, VarianceInfo>of("CharSequence", VarianceInfo.INVARIANT);
  Triple<String, VarianceInfo, VarianceInfo> _mappedTo_1 = this.operator_mappedTo(_mappedTo, VarianceInfo.INVARIANT);
  this.assertMapping(_mappedBy, "T", _mappedTo_1);
}