@Test public void testGetAdressWork() { when(this.location.getAddressString()).thenReturn("Pforzheim"); when(this.registry.getEntitiesWithTag("Work")).thenReturn(Collections.singletonList(this.location)); assertThat(this.connection.getAddress("Work"), equalTo("Pforzheim")); }
public String getAddress(String name) { Location address = null; List<Location> locations = this.locationRegistry.getEntitiesWithTag(name); if (!locations.isEmpty()) { address = locations.get(0); } else { for (Location location : this.locationRegistry.getAll()) { if (name.equalsIgnoreCase(location.getName()) || name.equalsIgnoreCase(location.getTag())) { address = location; break; } } } if (address == null) { return name; } return address.getAddressString(); }
RegistryConnection { public String getAddress(String name) { Location address = null; List<Location> locations = this.locationRegistry.getEntitiesWithTag(name); if (!locations.isEmpty()) { address = locations.get(0); } else { for (Location location : this.locationRegistry.getAll()) { if (name.equalsIgnoreCase(location.getName()) || name.equalsIgnoreCase(location.getTag())) { address = location; break; } } } if (address == null) { return name; } return address.getAddressString(); } }
RegistryConnection { public String getAddress(String name) { Location address = null; List<Location> locations = this.locationRegistry.getEntitiesWithTag(name); if (!locations.isEmpty()) { address = locations.get(0); } else { for (Location location : this.locationRegistry.getAll()) { if (name.equalsIgnoreCase(location.getName()) || name.equalsIgnoreCase(location.getTag())) { address = location; break; } } } if (address == null) { return name; } return address.getAddressString(); }  }
RegistryConnection { public String getAddress(String name) { Location address = null; List<Location> locations = this.locationRegistry.getEntitiesWithTag(name); if (!locations.isEmpty()) { address = locations.get(0); } else { for (Location location : this.locationRegistry.getAll()) { if (name.equalsIgnoreCase(location.getName()) || name.equalsIgnoreCase(location.getTag())) { address = location; break; } } } if (address == null) { return name; } return address.getAddressString(); }  String getAddress(String name); }
RegistryConnection { public String getAddress(String name) { Location address = null; List<Location> locations = this.locationRegistry.getEntitiesWithTag(name); if (!locations.isEmpty()) { address = locations.get(0); } else { for (Location location : this.locationRegistry.getAll()) { if (name.equalsIgnoreCase(location.getName()) || name.equalsIgnoreCase(location.getTag())) { address = location; break; } } } if (address == null) { return name; } return address.getAddressString(); }  String getAddress(String name);  }