PlanningSolutionSaveValidator implements SaveValidator<DataObject> { @Override public boolean accept(final Path path) { return path.getFileName().endsWith(".java"); } @Inject  PlanningSolutionSaveValidator(AssetsUsageService assetsUsageService); @Override Collection<ValidationMessage> validate(final Path dataObjectPath,
                                                  final DataObject dataObject); @Override boolean accept(final Path path);  }
@Test public void accept() { Path dataObjectPath = mock(Path.class); when(dataObjectPath.toURI()).thenReturn("file: when(dataObjectPath.getFileName()).thenReturn("Test.java"); assertTrue(saveValidator.accept(dataObjectPath)); Path propertiesPath = mock(Path.class); when(propertiesPath.getFileName()).thenReturn("Test.properties"); assertFalse(saveValidator.accept(propertiesPath)); }