コード例 #1
0
ファイル: InstanceStackTest.java プロジェクト: synle/aura
 /** Verify nothing serialized if no registered components */
 public void testSerializeAsPartNoComponents() throws Exception {
   InstanceStack iStack = new InstanceStack();
   iStack.setConfigAdapter(mci);
   JsonEncoder jsonMock = Mockito.mock(JsonEncoder.class);
   iStack.serializeAsPart(jsonMock);
   assertEquals(
       "Components should empty when no registered components", 0, iStack.getComponents().size());
   verifyZeroInteractions(jsonMock);
 }
コード例 #2
0
ファイル: InstanceStackTest.java プロジェクト: synle/aura
  /** Verify registered components are serialized in alphabetical order */
  public void testSerializeAsPart() throws Exception {
    InstanceStack iStack = new InstanceStack();
    iStack.setConfigAdapter(mci);
    JsonEncoder jsonMock = Mockito.mock(JsonEncoder.class);
    BaseComponent<?, ?> a = getComponentWithPath("a");
    BaseComponent<?, ?> b = getComponentWithPath("b");
    BaseComponent<?, ?> c = getComponentWithPath("c");
    iStack.registerComponent(b);
    iStack.registerComponent(c);
    iStack.registerComponent(a);
    iStack.serializeAsPart(jsonMock);

    List<BaseComponent<?, ?>> sorted = Lists.newArrayList();
    sorted.add(a);
    sorted.add(b);
    sorted.add(c);
    verify(jsonMock).writeMapKey("components");
    verify(jsonMock).writeArray(sorted);
  }
コード例 #3
0
 @Override
 public void serializeAsPart(Json json) throws IOException {
   if (fakeInstanceStack != null) {
     fakeInstanceStack.serializeAsPart(json);
   }
 }