### Question:
PerEpochTransition implements StateTransition<BeaconStateEx> { @Override public BeaconStateEx apply(BeaconStateEx origState) { logger.debug(() -> "Applying epoch transition to state: (" + spec.hash_tree_root(origState).toStringShort() + ") " + origState.toString(spec.getConstants(), spec::signing_root)); TransitionType.EPOCH.checkCanBeAppliedAfter(origState.getTransition()); MutableBeaconState state = origState.createMutableCopy(); spec.process_epoch(state); BeaconStateEx ret = new BeaconStateExImpl(state.createImmutable(), TransitionType.EPOCH); logger.debug(() -> "Epoch transition result state: (" + spec.hash_tree_root(ret).toStringShort() + ") " + ret.toString(spec.getConstants(), spec::signing_root)); return ret; } PerEpochTransition(BeaconChainSpec spec); @Override BeaconStateEx apply(BeaconStateEx origState);  }### Answer:
@Test public void test1() { Random rnd = new Random(); Time genesisTime = Time.castFrom(UInt64.random(rnd)); SpecConstants specConstants = new SpecConstants() { @Override public SlotNumber.EpochLength getSlotsPerEpoch() { return new SlotNumber.EpochLength(UInt64.valueOf(8)); } }; BeaconChainSpec spec = BeaconChainSpec.createWithoutDepositVerification(specConstants); List<Deposit> deposits = TestUtils.getAnyDeposits(rnd, spec, 8).getValue0(); Eth1Data eth1Data = new Eth1Data(Hash32.random(rnd), UInt64.valueOf(deposits.size()), Hash32.random(rnd)); InitialStateTransition initialStateTransition = new InitialStateTransition(new ChainStart(genesisTime, eth1Data, deposits), spec); BeaconStateEx initialState = initialStateTransition.apply(spec.get_empty_block()); BeaconStateEx currentState = initialState; ExtendedSlotTransition extendedSlotTransition = ExtendedSlotTransition.create(spec); for (int i = 0; i < 2 * spec.getConstants().getSlotsPerEpoch().getIntValue(); i++) { currentState = extendedSlotTransition.apply(currentState); } for (int i = 0; i < deposits.size(); i++) { Gwei balanceBefore = initialState.getBalances().get(ValidatorIndex.of(i)); Gwei balanceAfter = currentState.getBalances().get(ValidatorIndex.of(i)); Assert.assertTrue(balanceAfter.less(balanceBefore)); } }