Files
guice/core/test/com/google/inject/ModuleTest.java
T
lukesandSam Berlin 34e7c5d715 Run google-java-format on all Guice code.
configure a presubmit to ensure that it stays formatted.

Highlights include:
* simplified import order
* method annotations are now consistently defined on the preceding line
* javadoc reformatted to 100 chars column width

One test that contained line numbers in error messages had to be modified and
the formatter didn't like some of the more complicated preprocessor directives
(MOE and AOP).

To avoid formatting the copyright notices as javadoc i did a preprocessing step to rewrite the initial '/**' to '/*' using perl

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132718493
2016-09-13 11:47:18 -04:00

68 lines
1.2 KiB
Java

// Copyright 2007 Google Inc. All Rights Reserved.
package com.google.inject;
import junit.framework.TestCase;
/**
* Tests relating to modules.
*
* @author kevinb
*/
public class ModuleTest extends TestCase {
static class A implements Module {
@Override
public void configure(Binder binder) {
binder.bind(X.class);
binder.install(new B());
binder.install(new C());
}
}
static class B implements Module {
@Override
public void configure(Binder binder) {
binder.bind(Y.class);
binder.install(new D());
}
}
static class C implements Module {
@Override
public void configure(Binder binder) {
binder.bind(Z.class);
binder.install(new D());
}
}
static class D implements Module {
@Override
public void configure(Binder binder) {
binder.bind(W.class);
}
@Override
public boolean equals(Object obj) {
return obj.getClass() == D.class; // we're all equal in the eyes of guice
}
@Override
public int hashCode() {
return D.class.hashCode();
}
}
static class X {}
static class Y {}
static class Z {}
static class W {}
public void testDiamond() throws Exception {
Guice.createInjector(new A());
}
}