Java example source code file (Java8LanguageFeatureBindingTest.java)
This example Java source code file (Java8LanguageFeatureBindingTest.java) is included in the alvinalexander.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
The Java8LanguageFeatureBindingTest.java Java example source code
/**
* Copyright (C) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.inject.jdk8;
import com.google.inject.AbstractModule;
import com.google.inject.CreationException;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.Provides;
import com.google.inject.ProvisionException;
import com.google.inject.TypeLiteral;
import junit.framework.TestCase;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
/**
* Test bindings to lambdas, method references, etc.
*
* @author cgdecker@google.com (Colin Decker)
*/
public class Java8LanguageFeatureBindingTest extends TestCase {
// Some of these tests are kind of weird.
// See https://github.com/google/guice/issues/757 for more on why they exist.
public void testBinding_lambdaToInterface() {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<Predicate
Other Java examples (source code examples)
Here is a short list of links related to this Java Java8LanguageFeatureBindingTest.java source code file: