Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 92f862c

Browse files
committed
Renamed MappingValidatorImpl to DefaultMappingValidator to fit better in the naming scheme for single implementation interfaces
1 parent 18eec69 commit 92f862c

File tree

11 files changed

+49
-22
lines changed

11 files changed

+49
-22
lines changed

webtester-core/src/main/java/info/novatec/testit/webtester/internal/proxies/PageFragmentProxyHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import info.novatec.testit.webtester.internal.proxies.impls.WebElementReturningImpl;
3636
import info.novatec.testit.webtester.pagefragments.PageFragment;
3737
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidator;
38-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
38+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
3939

4040

4141
@Builder
@@ -103,7 +103,7 @@ public static PageFragmentProxyHandler fromModel(PageFragmentModel model) {
103103

104104
Browser browser = model.getBrowser();
105105
Class<? extends PageFragment> pageFragmentClass = model.getType();
106-
MappingValidator validator = new MappingValidatorImpl(pageFragmentClass);
106+
MappingValidator validator = new DefaultMappingValidator(pageFragmentClass);
107107
Supplier<WebElement> webElementSupplier = () -> {
108108
SearchContext searchContext = model.getSearchContextSupplier().get();
109109
By by = model.getBy();
@@ -129,7 +129,7 @@ public static PageFragmentProxyHandler fromModel(PageFragmentModel model) {
129129
public static PageFragmentProxyHandler forWebElement(Browser browser, WebElement webElement,
130130
Class<? extends PageFragment> pageFragmentClass) {
131131

132-
MappingValidator validator = new MappingValidatorImpl(pageFragmentClass);
132+
MappingValidator validator = new DefaultMappingValidator(pageFragmentClass);
133133
Supplier<WebElement> webElementSupplier = () -> webElement;
134134
EventProducingImplementationDecorator eventDecorator =
135135
new EventProducingImplementationDecorator(browser, webElementSupplier);

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/annotations/Mappings.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.lang.annotation.Target;
88

99
import info.novatec.testit.webtester.pagefragments.PageFragment;
10-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
10+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
1111

1212

1313
/**
@@ -16,7 +16,7 @@
1616
* your page fragments multiple times with {@link Mapping @Mapping}.
1717
*
1818
* @see Mapping
19-
* @see MappingValidatorImpl
19+
* @see DefaultMappingValidator
2020
* @see PageFragment
2121
* @since 2.0
2222
*/

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/ByProducers.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package info.novatec.testit.webtester.pagefragments.identification;
22

3-
import java.lang.reflect.UndeclaredThrowableException;
43
import java.util.Map;
54
import java.util.concurrent.ConcurrentHashMap;
65

@@ -88,8 +87,8 @@ private static ByProducer createNewInstanceOf(Class<? extends ByProducer> produc
8887
try {
8988
return producerClass.newInstance();
9089
} catch (InstantiationException | IllegalAccessException e) {
91-
String message = "unable to create " + ByProducer.class.getSimpleName() + " for: " + producerClass;
92-
throw new UndeclaredThrowableException(e, message);
90+
String message = "unable to create instance of " + producerClass;
91+
throw new InvalidByProducerException(message, e);
9392
}
9493
}
9594

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package info.novatec.testit.webtester.pagefragments.identification;
2+
3+
import info.novatec.testit.webtester.WebTesterException;
4+
5+
6+
/**
7+
* This exception is thrown if a {@link ByProducer} could not be initialized.
8+
*
9+
* @see ByProducers
10+
* @since 2.0
11+
*/
12+
public class InvalidByProducerException extends WebTesterException {
13+
14+
public InvalidByProducerException(String message, Throwable cause) {
15+
super(message, cause);
16+
}
17+
18+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
* @see MappingValidator
2424
* @since 2.0
2525
*/
26-
public class MappingValidatorImpl implements MappingValidator {
26+
public class DefaultMappingValidator implements MappingValidator {
2727

2828
private final Class<? extends PageFragment> pageFragmentType;
2929
private final List<Validator> validators;
3030
private final List<String> validConstellationDescriptions;
3131

32-
public MappingValidatorImpl(Class<? extends PageFragment> pageFragmentType) {
32+
public DefaultMappingValidator(Class<? extends PageFragment> pageFragmentType) {
3333
this.pageFragmentType = pageFragmentType;
3434
this.validators = extractValidationInformation(pageFragmentType);
3535
this.validConstellationDescriptions = getValidConstellationDescriptions(this.validators);
@@ -38,7 +38,7 @@ public MappingValidatorImpl(Class<? extends PageFragment> pageFragmentType) {
3838
private static List<Validator> extractValidationInformation(Class<?> type) {
3939
Mapping[] annotations = type.getAnnotationsByType(Mapping.class);
4040
return Arrays.stream(annotations)
41-
.map(MappingValidatorImpl::convertToValidConstellation)
41+
.map(DefaultMappingValidator::convertToValidConstellation)
4242
.collect(Collectors.toList());
4343
}
4444

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/MappingException.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
package info.novatec.testit.webtester.pagefragments.mapping;
22

33
import info.novatec.testit.webtester.WebTesterException;
4+
import info.novatec.testit.webtester.pagefragments.PageFragment;
5+
import info.novatec.testit.webtester.pagefragments.annotations.Mapping;
6+
import info.novatec.testit.webtester.pagefragments.annotations.Mappings;
47

58

9+
/**
10+
* This exception is thrown in case a {@link PageFragment} instance does not comply with the defined {@link Mapping}.
11+
*
12+
* @see Mapping
13+
* @see Mappings
14+
* @since 2.0
15+
*/
616
public class MappingException extends WebTesterException {
717

818
public MappingException(String message) {

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/validators/JustTag.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import info.novatec.testit.webtester.pagefragments.annotations.Mapping;
66
import info.novatec.testit.webtester.pagefragments.annotations.Mappings;
7-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
7+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
88
import info.novatec.testit.webtester.pagefragments.mapping.Validator;
99

1010

@@ -20,7 +20,7 @@
2020
* @see Validator
2121
* @see Mapping
2222
* @see Mappings
23-
* @see MappingValidatorImpl
23+
* @see DefaultMappingValidator
2424
* @since 2.0
2525
*/
2626
public class JustTag implements Validator {

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/validators/NoOpValidator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
import info.novatec.testit.webtester.pagefragments.annotations.Mapping;
66
import info.novatec.testit.webtester.pagefragments.annotations.Mappings;
7-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
7+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
88
import info.novatec.testit.webtester.pagefragments.mapping.Validator;
99

1010

1111
/**
1212
* This is a {@link Validator} implementation that basically does nothing. It will return <code>true</code> for each call on
1313
* {@link #isValid(WebElement)}. The main reason this class exists is to use it as a default in the {@link Mapping}
14-
* annotation. In case this class is set on the annotation (default), the {@link MappingValidatorImpl} will use the annotation's
14+
* annotation. In case this class is set on the annotation (default), the {@link DefaultMappingValidator} will use the annotation's
1515
* properties to generate a validator instead of using this one.
1616
*
1717
* @see Validator
1818
* @see Mapping
1919
* @see Mappings
20-
* @see MappingValidatorImpl
20+
* @see DefaultMappingValidator
2121
* @since 2.0
2222
*/
2323
public class NoOpValidator implements Validator {

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/validators/TagWithAttribute.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import info.novatec.testit.webtester.pagefragments.annotations.Mapping;
66
import info.novatec.testit.webtester.pagefragments.annotations.Mappings;
7-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
7+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
88
import info.novatec.testit.webtester.pagefragments.mapping.Validator;
99

1010

@@ -20,7 +20,7 @@
2020
* @see Validator
2121
* @see Mapping
2222
* @see Mappings
23-
* @see MappingValidatorImpl
23+
* @see DefaultMappingValidator
2424
* @since 2.0
2525
*/
2626
public class TagWithAttribute extends JustTag {

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/validators/TagWithAttributeAndValues.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import info.novatec.testit.webtester.pagefragments.annotations.Mapping;
1111
import info.novatec.testit.webtester.pagefragments.annotations.Mappings;
12-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
12+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
1313
import info.novatec.testit.webtester.pagefragments.mapping.Validator;
1414

1515

@@ -26,7 +26,7 @@
2626
* @see Validator
2727
* @see Mapping
2828
* @see Mappings
29-
* @see MappingValidatorImpl
29+
* @see DefaultMappingValidator
3030
* @since 2.0
3131
*/
3232
public class TagWithAttributeAndValues extends JustTag {

webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/validators/TagWithoutAttribute.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import info.novatec.testit.webtester.pagefragments.annotations.Mapping;
66
import info.novatec.testit.webtester.pagefragments.annotations.Mappings;
7-
import info.novatec.testit.webtester.pagefragments.mapping.MappingValidatorImpl;
7+
import info.novatec.testit.webtester.pagefragments.mapping.DefaultMappingValidator;
88
import info.novatec.testit.webtester.pagefragments.mapping.Validator;
99

1010

@@ -20,7 +20,7 @@
2020
* @see Validator
2121
* @see Mapping
2222
* @see Mappings
23-
* @see MappingValidatorImpl
23+
* @see DefaultMappingValidator
2424
* @since 2.0
2525
*/
2626
public class TagWithoutAttribute extends JustTag {

0 commit comments

Comments
 (0)