@SuppressWarnings("ConstantConditions") @Test void testTransformPackageNoChange() { EntityType entityType = mock(EntityType.class, RETURNS_DEEP_STUBS); when(entityType.getPackage().getId()).thenReturn("oldPackage"); Package newPackage = mock(Package.class); Map<String, Package> newPackages = ImmutableMap.of("otherOldPackage", newPackage); RelationTransformer.transformPackage(entityType, newPackages); verify(entityType, never()).setPackage(newPackage); }
static void transformPackage(EntityType entityType, Map<String, Package> newPackages) { if (newPackages.isEmpty()) { return; } Package entityTypePackage = entityType.getPackage(); if (entityTypePackage != null) { String packageId = entityTypePackage.getId(); if (newPackages.containsKey(packageId)) { entityType.setPackage(newPackages.get(packageId)); } } }
RelationTransformer { static void transformPackage(EntityType entityType, Map<String, Package> newPackages) { if (newPackages.isEmpty()) { return; } Package entityTypePackage = entityType.getPackage(); if (entityTypePackage != null) { String packageId = entityTypePackage.getId(); if (newPackages.containsKey(packageId)) { entityType.setPackage(newPackages.get(packageId)); } } } }
RelationTransformer { static void transformPackage(EntityType entityType, Map<String, Package> newPackages) { if (newPackages.isEmpty()) { return; } Package entityTypePackage = entityType.getPackage(); if (entityTypePackage != null) { String packageId = entityTypePackage.getId(); if (newPackages.containsKey(packageId)) { entityType.setPackage(newPackages.get(packageId)); } } } private  RelationTransformer(); }
RelationTransformer { static void transformPackage(EntityType entityType, Map<String, Package> newPackages) { if (newPackages.isEmpty()) { return; } Package entityTypePackage = entityType.getPackage(); if (entityTypePackage != null) { String packageId = entityTypePackage.getId(); if (newPackages.containsKey(packageId)) { entityType.setPackage(newPackages.get(packageId)); } } } private  RelationTransformer();  }
RelationTransformer { static void transformPackage(EntityType entityType, Map<String, Package> newPackages) { if (newPackages.isEmpty()) { return; } Package entityTypePackage = entityType.getPackage(); if (entityTypePackage != null) { String packageId = entityTypePackage.getId(); if (newPackages.containsKey(packageId)) { entityType.setPackage(newPackages.get(packageId)); } } } private  RelationTransformer();   }