@Test public void testRemove() { OneToOneMapping subject = makeSubject(); subject.add(SWITCH_ALPHA, REGION_A); subject.add(SWITCH_BETA, REGION_A); subject.remove(SWITCH_ALPHA); Optional<String> result = subject.lookup(SWITCH_ALPHA); Assert.assertTrue(result.isPresent()); Assert.assertEquals(REGION_A, result.get()); Assert.assertTrue(subject.lookup(SWITCH_ALPHA).isPresent()); clock.adjust(staleDelay.plus(Duration.ofSeconds(1))); Assert.assertFalse(subject.lookup(SWITCH_ALPHA).isPresent()); Assert.assertTrue(subject.lookup(SWITCH_BETA).isPresent()); }
public void remove(SwitchId switchId, String region) { remove(switchId); }
OneToOneMapping implements MappingApproach { public void remove(SwitchId switchId, String region) { remove(switchId); } }
OneToOneMapping implements MappingApproach { public void remove(SwitchId switchId, String region) { remove(switchId); } OneToOneMapping(Clock clock, Duration staleWipeDelay); }
OneToOneMapping implements MappingApproach { public void remove(SwitchId switchId, String region) { remove(switchId); } OneToOneMapping(Clock clock, Duration staleWipeDelay); Optional<String> lookup(SwitchId switchId); @Override void set(SwitchId switchId, String region); void add(SwitchId switchId, String region); void remove(SwitchId switchId, String region); void remove(SwitchId switchId); Map<String, Set<SwitchId>> makeReversedMapping(); }
OneToOneMapping implements MappingApproach { public void remove(SwitchId switchId, String region) { remove(switchId); } OneToOneMapping(Clock clock, Duration staleWipeDelay); Optional<String> lookup(SwitchId switchId); @Override void set(SwitchId switchId, String region); void add(SwitchId switchId, String region); void remove(SwitchId switchId, String region); void remove(SwitchId switchId); Map<String, Set<SwitchId>> makeReversedMapping();  }