PageRenderTime 520ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/code.lucamarrocco.scala.eclipse/test/code/lucamarrocco/scala/eclipse/ScalaModuleTest.java

http://scala-eclipse-plugin.googlecode.com/
Java | 80 lines | 54 code | 26 blank | 0 comment | 0 complexity | 6586bb1cbd176eb6711dd47906faa04f MD5 | raw file
  1. package code.lucamarrocco.scala.eclipse;
  2. import static com.google.inject.Guice.*;
  3. import static org.hamcrest.Matchers.*;
  4. import static org.junit.Assert.*;
  5. import static org.mockito.Mockito.*;
  6. import org.eclipse.core.resources.*;
  7. import org.eclipse.core.runtime.*;
  8. import org.eclipse.core.runtime.content.*;
  9. import org.eclipse.ui.*;
  10. import org.junit.*;
  11. import com.google.inject.*;
  12. public class ScalaModuleTest {
  13. private Injector injector;
  14. private ScalaModule module;
  15. private Plugin plugin;
  16. private ILog log;
  17. private IEditorRegistry editorRegistry;
  18. private IContentTypeManager contentTypeManager;
  19. private IWorkspace workspace;
  20. @Before
  21. public void setUp() {
  22. plugin = mock(Plugin.class);
  23. log = mock(ILog.class);
  24. editorRegistry = mock(IEditorRegistry.class);
  25. contentTypeManager = mock(IContentTypeManager.class);
  26. workspace = mock(IWorkspace.class);
  27. module = new ScalaModule(plugin, log, editorRegistry, contentTypeManager, workspace);
  28. injector = createInjector(module);
  29. }
  30. @Test
  31. public void testInstantiateIndex() {
  32. final IIndex index = injector.getInstance(IIndex.class);
  33. assertThat(index, is(notNullValue()));
  34. }
  35. @Test
  36. public void testInstantiateInjector() {
  37. assertThat(injector, is(notNullValue()));
  38. }
  39. @Test
  40. public void testInstantiateSimpleLog() {
  41. final ISimpleLog simpleLog = injector.getInstance(ISimpleLog.class);
  42. assertThat(simpleLog, is(notNullValue()));
  43. }
  44. @Test
  45. public void testInstantiateWorkbench() {
  46. final ScalaEditorTest workbench = injector.getInstance(ScalaEditorTest.class);
  47. assertThat(workbench, is(notNullValue()));
  48. }
  49. @Test
  50. public void testInstantiateWorkspace() {
  51. final IScalaWorkspace workspace = injector.getInstance(IScalaWorkspace.class);
  52. assertThat(workspace, is(notNullValue()));
  53. }
  54. }