Пример #1
0
 public void testGetAccessReturnsPushedAccess() throws Exception {
   InstanceStack iStack = new InstanceStack();
   iStack.setConfigAdapter(mci);
   Instance<?> ti1 = new TestInstance("path1");
   iStack.pushAccess(ti1);
   assertEquals(ti1, iStack.getAccess());
 }
Пример #2
0
 public void testGetAccessReturnsTopOfAccessStackWhenInstance() throws Exception {
   InstanceStack iStack = new InstanceStack();
   iStack.setConfigAdapter(mci);
   Instance<?> ti1 = new TestInstance("path1");
   Instance<?> ti2 = new TestInstance("path2");
   iStack.pushInstance(ti1, ti1.getDescriptor());
   iStack.pushAccess(ti2);
   assertEquals(ti2, iStack.getAccess());
 }
Пример #3
0
 public void testPushThenPopAccessSuccess() throws Exception {
   InstanceStack iStack = new InstanceStack();
   iStack.setConfigAdapter(mci);
   Instance<?> ti1 = new TestInstance("path1");
   Instance<?> ti2 = new TestInstance("path2");
   iStack.pushAccess(ti1);
   iStack.pushAccess(ti2);
   iStack.popAccess(ti2);
   iStack.popAccess(ti1);
   assertNull("Stack should return null after popping only instance", iStack.getAccess());
 }
Пример #4
0
 public void testPopAccessPastEmptyThrowsError() throws Exception {
   InstanceStack iStack = new InstanceStack();
   iStack.setConfigAdapter(mci);
   Instance<?> ti1 = new TestInstance("path1");
   try {
     iStack.pushAccess(ti1);
     iStack.popAccess(ti1);
     iStack.popAccess(ti1);
     fail("Expected exception when popping access twice but only pushed instance once");
   } catch (Exception e) {
     assertExceptionMessage(e, AuraRuntimeException.class, "mismatched access pop");
   }
 }
Пример #5
0
 public void testPopAccessWithDifferentInstanceThrowsError() throws Exception {
   InstanceStack iStack = new InstanceStack();
   iStack.setConfigAdapter(mci);
   Instance<?> ti1 = new TestInstance("path1");
   Instance<?> ti2 = new TestInstance("path2");
   try {
     iStack.pushAccess(ti1);
     iStack.popAccess(ti2);
     fail("Expected exception when popping access with mismatched instances");
   } catch (Exception e) {
     assertExceptionMessage(e, AuraRuntimeException.class, "mismatched access pop");
   }
 }