/** * Test method for {@link * org.eclipse.emf.common.notify.impl.AdapterFactoryImpl#AdapterFactoryImpl()}. */ @Test public void testReturnSameInstanceImpl() { DiagramViewChangedEventNotifierFactory notifierFactory = new DiagramViewChangedEventNotifierFactory(); NotationAndUmlModelsFactory modelsFactory = new NotationAndUmlModelsFactory(); Diagram diagram1 = modelsFactory.newDiagram(); Diagram diagram2 = modelsFactory.newDiagram(); // Action DiagramViewChangedEventNotifier eventNotifier11 = (DiagramViewChangedEventNotifier) notifierFactory.adapt(diagram1, DiagramViewChangedEventNotifier.class); DiagramViewChangedEventNotifier eventNotifier12 = (DiagramViewChangedEventNotifier) notifierFactory.adapt(diagram1, DiagramViewChangedEventNotifier.class); DiagramViewChangedEventNotifier eventNotifier21 = (DiagramViewChangedEventNotifier) notifierFactory.adapt(diagram2, DiagramViewChangedEventNotifier.class); DiagramViewChangedEventNotifier eventNotifier22 = (DiagramViewChangedEventNotifier) notifierFactory.adapt(diagram2, DiagramViewChangedEventNotifier.class); // Assert assertNotNull("object created", eventNotifier11); assertNotNull("object created", eventNotifier21); assertNotEquals("instance are different between diagram", eventNotifier11, eventNotifier21); assertEquals("return the same instance", eventNotifier11, eventNotifier12); assertEquals("return the same instance", eventNotifier21, eventNotifier22); }
/** * Test method for {@link * org.eclipse.emf.common.notify.impl.AdapterFactoryImpl#AdapterFactoryImpl()}. */ @Test public void testDiagramViewChangedEventNotifierFactory() { DiagramViewChangedEventNotifierFactory notifierFactory = new DiagramViewChangedEventNotifierFactory(); NotationAndUmlModelsFactory modelsFactory = new NotationAndUmlModelsFactory(); Diagram diagram1 = modelsFactory.newDiagram(); // Action DiagramViewChangedEventNotifier eventNotifier = (DiagramViewChangedEventNotifier) notifierFactory.adapt(diagram1, DiagramViewChangedEventNotifier.class); // Assert assertNotNull("object created", eventNotifier); }