### Question:
FermaVxlanRepository extends FermaGenericRepository<Vxlan, VxlanData, VxlanFrame> implements VxlanRepository { @Override public Collection<Vxlan> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(VxlanFrame.FRAME_LABEL)) .toListExplicit(VxlanFrame.class).stream() .map(Vxlan::new) .collect(Collectors.toList()); } FermaVxlanRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<Vxlan> findAll(); @Override Collection<Vxlan> findByPathId(PathId pathId, PathId oppositePathId); @Override boolean exists(int vxlan); @Override Optional<Integer> findFirstUnassignedVxlan(int lowestVxlan, int highestVxlan);  }### Answer:
@Test public void shouldCreateVxlan() { Vxlan vxlan = createVxlan(); Collection<Vxlan> allVxlans = vxlanRepository.findAll(); Vxlan foundVxlan = allVxlans.iterator().next(); assertEquals(vxlan.getVni(), foundVxlan.getVni()); assertEquals(TEST_FLOW_ID, foundVxlan.getFlowId()); }
@Test public void shouldDeleteVxlan() { Vxlan vxlan = createVxlan(); transactionManager.doInTransaction(() -> vxlanRepository.remove(vxlan)); assertEquals(0, vxlanRepository.findAll().size()); }
@Test public void shouldDeleteFoundVxlan() { createVxlan(); transactionManager.doInTransaction(() -> { Collection<Vxlan> allVxlans = vxlanRepository.findAll(); Vxlan foundVxlan = allVxlans.iterator().next(); vxlanRepository.remove(foundVxlan); }); assertEquals(0, vxlanRepository.findAll().size()); }
@Test public void shouldSelectNextInOrderResourceWhenFindUnassignedVxlan() { int first = findUnassignedVxlanAndCreate("flow_1"); assertEquals(5, first); int second = findUnassignedVxlanAndCreate("flow_2"); assertEquals(6, second); int third = findUnassignedVxlanAndCreate("flow_3"); assertEquals(7, third); transactionManager.doInTransaction(() -> { vxlanRepository.findAll().stream() .filter(vxlan -> vxlan.getVni() == second) .forEach(vxlanRepository::remove); }); int fourth = findUnassignedVxlanAndCreate("flow_4"); assertEquals(6, fourth); int fifth = findUnassignedVxlanAndCreate("flow_5"); assertEquals(8, fifth); }