@Test public void resolve() { DataSnapshot dataSnapshot = Mockito.mock(DataSnapshot.class); DataSnapshot dataSnapshot2 = Mockito.mock(DataSnapshot.class); DataSnapshot dataSnapshot3 = Mockito.mock(DataSnapshot.class); ArrayList list = new ArrayList(); list.add(dataSnapshot2); list.add(dataSnapshot3); Mockito.when(dataSnapshot.getChildren()).thenReturn(list); Mockito.when(dataSnapshot.getValue()).thenReturn(list); List result = ResolverDataSnapshotList.resolve(dataSnapshot); Assert.assertEquals(2, result.size()); Mockito.verify(dataSnapshot2, VerificationModeFactory.times(1)).getValue(); Mockito.verify(dataSnapshot3, VerificationModeFactory.times(1)).getValue(); }
@SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } private  ResolverDataSnapshotList(); }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } private  ResolverDataSnapshotList();  }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } private  ResolverDataSnapshotList();   }