diff --git a/src/main/java/net/andreinc/mockneat/MockNeat.java b/src/main/java/net/andreinc/mockneat/MockNeat.java index 4b14bb5..712b2a5 100644 --- a/src/main/java/net/andreinc/mockneat/MockNeat.java +++ b/src/main/java/net/andreinc/mockneat/MockNeat.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockConstValue.java b/src/main/java/net/andreinc/mockneat/interfaces/MockConstValue.java index d79e9c7..91ad423 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockConstValue.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockConstValue.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.interfaces; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnit.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnit.java index 7aab3e5..8da6a03 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnit.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockUnit.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.interfaces; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated @@ -33,8 +33,10 @@ import static java.lang.String.format; import static java.util.stream.IntStream.range; +import static java.util.stream.Stream.generate; import static net.andreinc.aleph.AlephFormatter.template; import static net.andreinc.mockneat.utils.LoopsUtils.loop; +import static net.andreinc.mockneat.utils.MockUnitUtils.ifSupplierNotNullDo; import static net.andreinc.mockneat.utils.MockUnitUtils.put; import static net.andreinc.mockneat.utils.ValidationUtils.*; @@ -45,8 +47,28 @@ public interface MockUnit<T> { // Functional Method Supplier<T> supplier(); + /** + * It's a 'closing' method that returns an arbitrary value of type 'T'. + * + * @return the exact value mocked by the MockUnit<T> . The value is of type <T>. + */ default T val() { return supplier().get(); } + + default T valOrElse(T alternateVal) { + T result = supplier().get(); + if (null==result) + return alternateVal; + return result; + } + + /** + * Serialize an arbitary object generated by the MockUnit<T> to the disk. + * T should implement Serializable. + * + * @param strPath The path where the file is written to disk. + * + */ // TODO Document default void serialize(String strPath) { T object = supplier().get(); @@ -58,20 +80,47 @@ default void serialize(String strPath) { catch (FileNotFoundException e) { throw new UncheckedIOException(e); } } + /** + * It's a closing method that returns an arbitray value of type <T> + * + * @param function The function that is applied to the final value before being returned. + * @param <R> The Returning type of the the applied Function<T, R>. + * @return + */ default <R> R val(Function<T, R> function) { notNull(function, "function"); return function.apply(supplier().get()); } + /** + * Consumes the returning value (of type <T>). + * So instead of returning the arbitrary value generated by the MockUnit<T>, + * this is getting consumed. + * + * @param consumer The consumer method. + */ default void consume(Consumer<T> consumer) { notNull(consumer, "consumer"); consumer.accept(val()); } + /** + * Returns the toString() representation of the arbitrary data generated by the MockUnit<T>. + * If the generated value is NULL, the default "" - empty string is generated. + * + * @return the toString() representation value of the data generated by the MockUnit<T>. + */ default String valStr() { return valStr(""); } + /** + * Retuns the toString() representation of the arbitrary genrated by the MockUnit<T>. + * If the generated value is NULL it's replaced with a default String value. + * + * @param valueIfNull The default value that is returned if the generated value is null. + * @return the toString() representation value of the data generated by the MockUnit<T>. + */ default String valStr(String valueIfNull) { Object val = supplier().get(); if (null == val) { @@ -80,6 +129,13 @@ default String valStr(String valueIfNull) { return val.toString(); } + /** + * This method is used to transform the existing MockUnit<T> mock unit into + * an MockUnit<R> through the function received as parameter (Function<T,R>). + * + * @param function The transforming function. + * @return + */ default <R> MockUnit<R> map(Function<T, R> function) { notNull(function, "function"); Supplier<R> supp = () -> function.apply(supplier().get()); @@ -111,11 +167,11 @@ default MockUnitString mapToString(Function<T, String> function) { } default MockUnitString mapToString() { - return () -> val()::toString; + return () -> ifSupplierNotNullDo(supplier(), s -> val().toString()); } default MockUnit<Stream<T>> stream() { - Supplier<Stream<T>> supp = () -> Stream.generate(supplier()); + Supplier<Stream<T>> supp = () -> generate(supplier()); return () -> supp; } diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitDays.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitDays.java index fa481b3..653a4df 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitDays.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitDays.java @@ -20,8 +20,9 @@ import java.time.DayOfWeek; import java.time.format.TextStyle; import java.util.Locale; -import java.util.function.Supplier; +import static java.time.format.TextStyle.FULL_STANDALONE; +import static net.andreinc.mockneat.utils.MockUnitUtils.ifSupplierNotNullDo; import static net.andreinc.mockneat.utils.ValidationUtils.notNull; public interface MockUnitDays extends MockUnit<DayOfWeek> { @@ -29,9 +30,8 @@ public interface MockUnitDays extends MockUnit<DayOfWeek> { default MockUnitString display(TextStyle textStyle, Locale locale) { notNull(textStyle, "textStyle"); notNull(locale, "locale"); - Supplier<String> supp = - () -> supplier().get().getDisplayName(textStyle, locale); - return () -> supp; + return () -> + ifSupplierNotNullDo(supplier(), s -> s.getDisplayName(textStyle, locale)); } default MockUnitString display(TextStyle textStyle) { @@ -40,6 +40,6 @@ default MockUnitString display(TextStyle textStyle) { } default MockUnitString display() { - return display(TextStyle.FULL_STANDALONE); + return display(FULL_STANDALONE); } } diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitFloat.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitFloat.java index 197ced8..656ccff 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitFloat.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitFloat.java @@ -1,23 +1,40 @@ package net.andreinc.mockneat.interfaces; -import net.andreinc.mockneat.utils.ValidationUtils; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import java.util.function.Supplier; import java.util.stream.DoubleStream; +import static java.util.stream.DoubleStream.generate; import static java.util.stream.IntStream.range; +import static net.andreinc.mockneat.utils.ValidationUtils.SIZE_BIGGER_THAN_ZERO; import static net.andreinc.mockneat.utils.ValidationUtils.isTrue; //TODO add it in documentation public interface MockUnitFloat extends MockUnit<Float> { default MockUnit<DoubleStream> doubleStream() { - Supplier<DoubleStream> supp = () -> DoubleStream.generate(supplier()::get); + Supplier<DoubleStream> supp = () -> generate(supplier()::get); return () -> supp; } default MockUnit<float[]> arrayPrimitive(int size) { - isTrue(size>=0, ValidationUtils.SIZE_BIGGER_THAN_ZERO); + isTrue(size>=0, SIZE_BIGGER_THAN_ZERO); Supplier<float[]> supp = () -> { final float[] result = new float[size]; range(0, size).forEach(i -> result[i] = val()); @@ -26,7 +43,7 @@ default MockUnit<float[]> arrayPrimitive(int size) { return () -> supp; } default MockUnit<Float[]> array(int size) { - isTrue(size>=0, ValidationUtils.SIZE_BIGGER_THAN_ZERO); + isTrue(size>=0, SIZE_BIGGER_THAN_ZERO); Supplier<Float[]> supp = () -> { final Float[] result = new Float[size]; range(0, size).forEach(i -> result[i] = val()); diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLocalDate.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLocalDate.java index 3b83fd0..50da3c9 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLocalDate.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLocalDate.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.interfaces; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import java.time.LocalDate; public interface MockUnitLocalDate extends MockUnit<LocalDate> { diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLogger.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLogger.java deleted file mode 100644 index 29dd4b6..0000000 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitLogger.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.andreinc.mockneat.interfaces; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -class MockUnitLogger { - public static final Logger logger = LoggerFactory.getLogger(MockUnit.class); - private MockUnitLogger() {} -} diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitString.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitString.java index aa49640..ece663b 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitString.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitString.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.interfaces; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated @@ -17,27 +17,25 @@ OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ -import net.andreinc.mockneat.utils.ValidationUtils; import net.andreinc.mockneat.types.enums.StringFormatType; +import net.andreinc.mockneat.utils.ValidationUtils; import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringEscapeUtils; import java.io.UnsupportedEncodingException; -import java.util.function.Supplier; import static java.net.URLEncoder.encode; import static net.andreinc.aleph.AlephFormatter.template; +import static net.andreinc.mockneat.utils.MockUnitUtils.ifSupplierNotNullDo; import static net.andreinc.mockneat.utils.ValidationUtils.notNull; -import static org.apache.commons.lang3.Validate.notEmpty; @FunctionalInterface public interface MockUnitString extends MockUnit<String> { default MockUnitString format(StringFormatType formatType) { notNull(formatType, "formatType"); - Supplier<String> supplier = () -> formatType.getFormatter().apply(supplier().get()); - return () -> supplier; + return () -> ifSupplierNotNullDo(supplier(), formatType.getFormatter()::apply); } default MockUnitString sub(int endIndex) { @@ -45,62 +43,59 @@ default MockUnitString sub(int endIndex) { } default MockUnitString sub(int beginIndex, int endIndex) { - Supplier<String> supplier = () -> supplier().get().substring(beginIndex, endIndex); - return () -> supplier; + return () -> ifSupplierNotNullDo(supplier(), s -> s.substring(beginIndex, endIndex)); } default MockUnitString append(String str) { - notEmpty(str, "str"); - Supplier<String> supplier = () -> supplier().get().concat(str); - return () -> supplier; + notNull(str, "str"); + return () -> ifSupplierNotNullDo(supplier(), s -> s.concat(str)); } default MockUnitString prepend(String str) { - notEmpty(str); - Supplier<String> supplier = () -> str.concat(supplier().get()); - return () -> supplier; + notNull(str, "str"); + return () -> ifSupplierNotNullDo(supplier(), str::concat); } default MockUnitString replace(char oldCHar, char newChar) { - Supplier<String> supplier = () -> supplier().get().replace(oldCHar, newChar); - return () -> supplier; + return () -> ifSupplierNotNullDo(supplier(), s -> s.replace(oldCHar, newChar)); } default MockUnitString replace(CharSequence target, CharSequence replacement) { - Supplier<String> supplier = () -> supplier().get().replace(target, replacement); - return () -> supplier; + notNull(target, "target"); + notNull(replacement, "replacement"); + return () -> ifSupplierNotNullDo(supplier(), s -> s.replace(target, replacement)); } default MockUnitString replaceAll(String regex, String replacement) { - Supplier<String > supplier = () -> supplier().get().replaceAll(regex, replacement); - return () -> supplier; + notNull(regex, "regex"); + notNull(replacement, "replacement"); + return () -> ifSupplierNotNullDo(supplier(), s -> s.replaceAll(regex,replacement)); } default MockUnitString replaceFirst(String regex, String replacement) { - Supplier<String> supplier = () -> supplier().get().replaceFirst(regex, replacement); - return () -> supplier; + notNull(regex, "regex"); + notNull(replacement, "replacement"); + return () -> ifSupplierNotNullDo(supplier(), s -> s.replaceFirst(regex, replacement)); } default MockUnit<String[]> split(String regex, int limit) { - Supplier<String[]> supplier = () -> supplier().get().split(regex, limit); - return () -> supplier; + notNull(regex, "regex"); + return () -> ifSupplierNotNullDo(supplier(), s -> s.split(regex, limit)); } default MockUnit<String[]> split(String regex) { return split(regex, 0); } - default MockUnitString urlEncode(String enc) { - Supplier<String> supplier = () -> { - String val = supplier().get(); - try { - return encode(val, enc); - } catch (UnsupportedEncodingException e) { - String msg = template(ValidationUtils.CANNOT_URL_ENCODE_UTF_8, "val", val).fmt(); + default MockUnitString urlEncode(String encoding) { + notNull(encoding, "encoding"); + return () -> ifSupplierNotNullDo(supplier(), s -> { + try { return encode(s, encoding); } + catch (UnsupportedEncodingException e) { + String msg = template(ValidationUtils.CANNOT_URL_ENCODE_UTF_8, "val", s).fmt(); throw new IllegalArgumentException(msg, e); } - }; - return () -> supplier; + }); } default MockUnitString urlEncode() { @@ -108,32 +103,54 @@ default MockUnitString urlEncode() { } default MockUnitString noSpecialChars() { - return () -> () -> supplier().get().replaceAll("[^\\dA-Za-z ]", ""); + return () -> ifSupplierNotNullDo(supplier(), s -> s.replaceAll("[^\\dA-Za-z ]", "")); } - default MockUnitString escapeCsv() { return () -> () -> StringEscapeUtils.escapeCsv(supplier().get()); } + default MockUnitString escapeCsv() { + return () -> ifSupplierNotNullDo(supplier(), StringEscapeUtils::escapeCsv); + } - default MockUnitString escapeEcmaScript() { return () -> () -> StringEscapeUtils.escapeEcmaScript(supplier().get()); } + default MockUnitString escapeEcmaScript() { + return () -> ifSupplierNotNullDo(supplier(), StringEscapeUtils::escapeEcmaScript); + } - default MockUnitString escapeHtml() { return () -> () -> StringEscapeUtils.escapeHtml4(supplier().get()); } + default MockUnitString escapeHtml() { + return () -> ifSupplierNotNullDo(supplier(), StringEscapeUtils::escapeHtml4); + } - default MockUnitString escapeXml() { return() -> () -> StringEscapeUtils.escapeXml11(supplier().get()); } + default MockUnitString escapeXml() { + return () -> ifSupplierNotNullDo(supplier(), StringEscapeUtils::escapeXml11); + } // TODO document methods - default MockUnitString md2() { return () -> () -> DigestUtils.md2Hex(supplier().get()); } + default MockUnitString md2() { + return () -> ifSupplierNotNullDo(supplier(), DigestUtils::md2Hex); + } - default MockUnitString md5() { return () -> () -> DigestUtils.md5Hex(supplier().get()); } + default MockUnitString md5() { + return () -> ifSupplierNotNullDo(supplier(), DigestUtils::md5Hex); + } - default MockUnitString sha1() { return () -> () -> DigestUtils.sha1Hex(supplier().get()); } + default MockUnitString sha1() { + return () -> ifSupplierNotNullDo(supplier(), DigestUtils::sha1Hex); + } - default MockUnitString sha256() { return () -> () -> DigestUtils.sha256Hex(supplier().get()); } + default MockUnitString sha256() { + return () -> ifSupplierNotNullDo(supplier(), DigestUtils::sha256Hex); + } - default MockUnitString sha384() { return () -> () -> DigestUtils.sha384Hex(supplier().get()); } + default MockUnitString sha384() { + return () -> ifSupplierNotNullDo(supplier(), DigestUtils::sha384Hex); + } - default MockUnitString sha512() { return () -> () -> DigestUtils.sha512Hex(supplier().get()); } + default MockUnitString sha512() { + return () -> ifSupplierNotNullDo(supplier(), DigestUtils::sha512Hex); + } - default MockUnitString base64() { return () -> () -> new Base64().encodeAsString(supplier().get().getBytes()); } + default MockUnitString base64() { + return () -> ifSupplierNotNullDo(supplier(), (str) -> new Base64().encodeAsString(str.getBytes())); + } default MockUnit<String[]> array(int size) { return array(String.class, size); diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitValue.java b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitValue.java index 0d57869..6d453d8 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockUnitValue.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockUnitValue.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.interfaces; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + public class MockUnitValue implements MockValue { private final MockUnit mockUnit; diff --git a/src/main/java/net/andreinc/mockneat/interfaces/MockValue.java b/src/main/java/net/andreinc/mockneat/interfaces/MockValue.java index c575831..8e2e5b2 100644 --- a/src/main/java/net/andreinc/mockneat/interfaces/MockValue.java +++ b/src/main/java/net/andreinc/mockneat/interfaces/MockValue.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.interfaces; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/Pair.java b/src/main/java/net/andreinc/mockneat/types/Pair.java index 868e9e7..fc0a15e 100644 --- a/src/main/java/net/andreinc/mockneat/types/Pair.java +++ b/src/main/java/net/andreinc/mockneat/types/Pair.java @@ -2,7 +2,7 @@ import java.util.function.Supplier; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/Range.java b/src/main/java/net/andreinc/mockneat/types/Range.java index b9f06cf..763fe06 100644 --- a/src/main/java/net/andreinc/mockneat/types/Range.java +++ b/src/main/java/net/andreinc/mockneat/types/Range.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/CVVType.java b/src/main/java/net/andreinc/mockneat/types/enums/CVVType.java index e9fc3a4..c0e2722 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/CVVType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/CVVType.java @@ -18,7 +18,8 @@ */ public enum CVVType { - CVV3(3), CVV4(4); + CVV3(3), + CVV4(4); private final Integer length; diff --git a/src/main/java/net/andreinc/mockneat/types/enums/CharsType.java b/src/main/java/net/andreinc/mockneat/types/enums/CharsType.java index 8ca034e..66e580d 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/CharsType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/CharsType.java @@ -18,5 +18,10 @@ */ public enum CharsType { - DIGITS, LOWER_LETTERS, UPPER_LETTERS, LETTERS, HEX, ALPHA_NUMERIC + DIGITS, + LOWER_LETTERS, + UPPER_LETTERS, + LETTERS, + HEX, + ALPHA_NUMERIC } diff --git a/src/main/java/net/andreinc/mockneat/types/enums/CreditCardType.java b/src/main/java/net/andreinc/mockneat/types/enums/CreditCardType.java index 1733fe8..c2e538e 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/CreditCardType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/CreditCardType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/CurrencySymbolType.java b/src/main/java/net/andreinc/mockneat/types/enums/CurrencySymbolType.java index 88c557b..1af9bca 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/CurrencySymbolType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/CurrencySymbolType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/DomainSuffixType.java b/src/main/java/net/andreinc/mockneat/types/enums/DomainSuffixType.java index f3bdd42..5b75350 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/DomainSuffixType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/DomainSuffixType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/HostNameType.java b/src/main/java/net/andreinc/mockneat/types/enums/HostNameType.java index e1edd2f..b273e27 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/HostNameType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/HostNameType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/IBANType.java b/src/main/java/net/andreinc/mockneat/types/enums/IBANType.java index f2cfbac..8d84d29 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/IBANType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/IBANType.java @@ -1,5 +1,21 @@ package net.andreinc.mockneat.types.enums; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.types.Pair; @@ -11,9 +27,6 @@ import static net.andreinc.mockneat.types.enums.CharsType.DIGITS; import static net.andreinc.mockneat.types.enums.CharsType.UPPER_LETTERS; -/** - * Created by andreinicolinciobanu on 07/05/17. - */ public enum IBANType { ALBANIA( diff --git a/src/main/java/net/andreinc/mockneat/types/enums/IPv4Type.java b/src/main/java/net/andreinc/mockneat/types/enums/IPv4Type.java index 7fcb808..10925a0 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/IPv4Type.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/IPv4Type.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/MACAddressFormatType.java b/src/main/java/net/andreinc/mockneat/types/enums/MACAddressFormatType.java index bd59286..b6e500a 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/MACAddressFormatType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/MACAddressFormatType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/NameType.java b/src/main/java/net/andreinc/mockneat/types/enums/NameType.java index b55534c..613ff55 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/NameType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/NameType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/PassStrengthType.java b/src/main/java/net/andreinc/mockneat/types/enums/PassStrengthType.java index ac06431..15a6e0e 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/PassStrengthType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/PassStrengthType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/RandomType.java b/src/main/java/net/andreinc/mockneat/types/enums/RandomType.java index 3b385f8..568197a 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/RandomType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/RandomType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/StringFormatType.java b/src/main/java/net/andreinc/mockneat/types/enums/StringFormatType.java index 62f6456..9c4a950 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/StringFormatType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/StringFormatType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/types/enums/StringType.java b/src/main/java/net/andreinc/mockneat/types/enums/StringType.java index 235e04e..c070955 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/StringType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/StringType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated @@ -18,5 +18,9 @@ */ public enum StringType { - NUMBERS, ALPHA_NUMERIC, LETTERS, HEX, SPECIAL_CHARACTERS + NUMBERS, + ALPHA_NUMERIC, + LETTERS, + HEX, + SPECIAL_CHARACTERS } diff --git a/src/main/java/net/andreinc/mockneat/types/enums/URLSchemeType.java b/src/main/java/net/andreinc/mockneat/types/enums/URLSchemeType.java index 279f235..3630f8f 100644 --- a/src/main/java/net/andreinc/mockneat/types/enums/URLSchemeType.java +++ b/src/main/java/net/andreinc/mockneat/types/enums/URLSchemeType.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.types.enums; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/address/Countries.java b/src/main/java/net/andreinc/mockneat/unit/address/Countries.java index fba9fc8..648ec21 100644 --- a/src/main/java/net/andreinc/mockneat/unit/address/Countries.java +++ b/src/main/java/net/andreinc/mockneat/unit/address/Countries.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.address; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/companies/Departments.java b/src/main/java/net/andreinc/mockneat/unit/companies/Departments.java index 132363b..b0198d1 100644 --- a/src/main/java/net/andreinc/mockneat/unit/companies/Departments.java +++ b/src/main/java/net/andreinc/mockneat/unit/companies/Departments.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.companies; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/hashes/Hashes.java b/src/main/java/net/andreinc/mockneat/unit/hashes/Hashes.java index 19da055..b289ee0 100644 --- a/src/main/java/net/andreinc/mockneat/unit/hashes/Hashes.java +++ b/src/main/java/net/andreinc/mockneat/unit/hashes/Hashes.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnitString; import org.apache.commons.codec.digest.DigestUtils; @@ -7,9 +24,6 @@ import java.util.function.Function; import java.util.function.Supplier; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class Hashes { private static final Integer HASHED_STRING_SIZE = 128; diff --git a/src/main/java/net/andreinc/mockneat/unit/misc/ISSNS.java b/src/main/java/net/andreinc/mockneat/unit/misc/ISSNS.java index e0e9575..e836aa2 100644 --- a/src/main/java/net/andreinc/mockneat/unit/misc/ISSNS.java +++ b/src/main/java/net/andreinc/mockneat/unit/misc/ISSNS.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.misc; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnitString; @@ -7,9 +24,6 @@ import static org.apache.commons.lang3.StringUtils.join; -/** - * Created by andreinicolinciobanu on 26/03/17. - */ public class ISSNS implements MockUnitString { private static final String ISSN_PREFIX = "ISSN"; diff --git a/src/main/java/net/andreinc/mockneat/unit/misc/SSCs.java b/src/main/java/net/andreinc/mockneat/unit/misc/SSCs.java index b8694c7..06b15b3 100644 --- a/src/main/java/net/andreinc/mockneat/unit/misc/SSCs.java +++ b/src/main/java/net/andreinc/mockneat/unit/misc/SSCs.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.misc; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnitString; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.FormatUtils.prependZeroesToSize; -/** - * Created by andreinicolinciobanu on 24/03/17. - */ public class SSCs implements MockUnitString { private final MockNeat mockNeat; diff --git a/src/main/java/net/andreinc/mockneat/unit/networking/Domains.java b/src/main/java/net/andreinc/mockneat/unit/networking/Domains.java index eefc7df..f23f4c1 100644 --- a/src/main/java/net/andreinc/mockneat/unit/networking/Domains.java +++ b/src/main/java/net/andreinc/mockneat/unit/networking/Domains.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.networking; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/networking/IPv6s.java b/src/main/java/net/andreinc/mockneat/unit/networking/IPv6s.java index fb78343..f11f360 100644 --- a/src/main/java/net/andreinc/mockneat/unit/networking/IPv6s.java +++ b/src/main/java/net/andreinc/mockneat/unit/networking/IPv6s.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.networking; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/networking/URLs.java b/src/main/java/net/andreinc/mockneat/unit/networking/URLs.java index d038522..00a5e36 100644 --- a/src/main/java/net/andreinc/mockneat/unit/networking/URLs.java +++ b/src/main/java/net/andreinc/mockneat/unit/networking/URLs.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.networking; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnitString; import net.andreinc.mockneat.types.Pair; diff --git a/src/main/java/net/andreinc/mockneat/unit/objects/Constructor.java b/src/main/java/net/andreinc/mockneat/unit/objects/Constructor.java index badfcfe..b3cb6d4 100644 --- a/src/main/java/net/andreinc/mockneat/unit/objects/Constructor.java +++ b/src/main/java/net/andreinc/mockneat/unit/objects/Constructor.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.interfaces.MockUnit; import net.andreinc.mockneat.utils.MockUnitUtils; @@ -13,7 +30,6 @@ import static net.andreinc.mockneat.utils.ValidationUtils.notNull; import static org.apache.commons.lang3.reflect.ConstructorUtils.invokeConstructor; -//TODO document this public class Constructor<T> implements MockUnit<T> { private final Class<T> cls; diff --git a/src/main/java/net/andreinc/mockneat/unit/objects/Factory.java b/src/main/java/net/andreinc/mockneat/unit/objects/Factory.java index 4ba4d7c..1106f50 100644 --- a/src/main/java/net/andreinc/mockneat/unit/objects/Factory.java +++ b/src/main/java/net/andreinc/mockneat/unit/objects/Factory.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.interfaces.MockUnit; import net.andreinc.mockneat.utils.MockUnitUtils; diff --git a/src/main/java/net/andreinc/mockneat/unit/objects/Probabilities.java b/src/main/java/net/andreinc/mockneat/unit/objects/Probabilities.java index a6d634d..20ac820 100644 --- a/src/main/java/net/andreinc/mockneat/unit/objects/Probabilities.java +++ b/src/main/java/net/andreinc/mockneat/unit/objects/Probabilities.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnit; import net.andreinc.mockneat.interfaces.MockUnitDouble; diff --git a/src/main/java/net/andreinc/mockneat/unit/objects/Reflect.java b/src/main/java/net/andreinc/mockneat/unit/objects/Reflect.java index e057c8c..7ffe86c 100644 --- a/src/main/java/net/andreinc/mockneat/unit/objects/Reflect.java +++ b/src/main/java/net/andreinc/mockneat/unit/objects/Reflect.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnit; import net.andreinc.mockneat.interfaces.MockValue; @@ -19,7 +36,6 @@ import static net.andreinc.mockneat.utils.ValidationUtils.*; import static org.apache.commons.lang3.reflect.FieldUtils.*; -//TODO document this public class Reflect<T> implements MockUnit<T> { private static final Pattern JAVA_FIELD_REGEX = diff --git a/src/main/java/net/andreinc/mockneat/unit/objects/Shufflers.java b/src/main/java/net/andreinc/mockneat/unit/objects/Shufflers.java index a8176ef..8e67874 100644 --- a/src/main/java/net/andreinc/mockneat/unit/objects/Shufflers.java +++ b/src/main/java/net/andreinc/mockneat/unit/objects/Shufflers.java @@ -1,7 +1,25 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.MockNeat; import net.andreinc.mockneat.interfaces.MockUnit; +import net.andreinc.mockneat.interfaces.MockUnitString; import java.util.ArrayList; import java.util.function.Supplier; @@ -17,14 +35,6 @@ public Shufflers(MockNeat mockNeat) { this.mockNeat = mockNeat; } - public MockNeat getMockNeat() { - return mockNeat; - } - - public void setMockNeat(MockNeat mockNeat) { - this.mockNeat = mockNeat; - } - public <T> MockUnit<T[]> array(T[] source) { notNull(source, "source"); Supplier<T[]> supplier = () -> { @@ -109,7 +119,7 @@ public <T> MockUnit<ArrayList<T>> arrayList(ArrayList<T> source) { notNull(source, "source"); Supplier<ArrayList<T>> supplier = () -> { ArrayList<T> result = (ArrayList<T>) source.clone(); - T tmp = null; + T tmp; for(int j, i = 0; i < result.size() - 2; ++i) { j = mockNeat.ints().range(i, result.size()).val(); tmp = result.get(i); @@ -121,4 +131,20 @@ public <T> MockUnit<ArrayList<T>> arrayList(ArrayList<T> source) { return () -> supplier; } + + public MockUnitString string(String source) { + notNull(source, "source"); + Supplier<String> supplier = () -> { + char[] chars = source.toCharArray(); + char c; + for(int j, i = 0; i < chars.length; ++i) { + j = mockNeat.ints().range(i, chars.length).val(); + c = chars[i]; + chars[i] = chars[j]; + chars[j] = c; + } + return new String(chars); + }; + return () -> supplier; + } } diff --git a/src/main/java/net/andreinc/mockneat/unit/regex/Regex.java b/src/main/java/net/andreinc/mockneat/unit/regex/Regex.java index 8559e44..f5e75d9 100644 --- a/src/main/java/net/andreinc/mockneat/unit/regex/Regex.java +++ b/src/main/java/net/andreinc/mockneat/unit/regex/Regex.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.regex; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import com.mifmif.common.regex.Generex; import net.andreinc.mockneat.interfaces.MockUnitString; diff --git a/src/main/java/net/andreinc/mockneat/unit/seq/IntSeq.java b/src/main/java/net/andreinc/mockneat/unit/seq/IntSeq.java index 17789e3..411fc88 100644 --- a/src/main/java/net/andreinc/mockneat/unit/seq/IntSeq.java +++ b/src/main/java/net/andreinc/mockneat/unit/seq/IntSeq.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.seq; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/seq/LongSeq.java b/src/main/java/net/andreinc/mockneat/unit/seq/LongSeq.java index 5943018..d0845cd 100644 --- a/src/main/java/net/andreinc/mockneat/unit/seq/LongSeq.java +++ b/src/main/java/net/andreinc/mockneat/unit/seq/LongSeq.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.seq; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/text/Dicts.java b/src/main/java/net/andreinc/mockneat/unit/text/Dicts.java index 09ed97c..6f45592 100644 --- a/src/main/java/net/andreinc/mockneat/unit/text/Dicts.java +++ b/src/main/java/net/andreinc/mockneat/unit/text/Dicts.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.text; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/text/Formatter.java b/src/main/java/net/andreinc/mockneat/unit/text/Formatter.java index 9b702d0..34a0294 100644 --- a/src/main/java/net/andreinc/mockneat/unit/text/Formatter.java +++ b/src/main/java/net/andreinc/mockneat/unit/text/Formatter.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.text; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/text/FromFiles.java b/src/main/java/net/andreinc/mockneat/unit/text/FromFiles.java index 82e9680..2760afc 100644 --- a/src/main/java/net/andreinc/mockneat/unit/text/FromFiles.java +++ b/src/main/java/net/andreinc/mockneat/unit/text/FromFiles.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.text; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/text/Markovs.java b/src/main/java/net/andreinc/mockneat/unit/text/Markovs.java index 4876a9f..0c2e027 100644 --- a/src/main/java/net/andreinc/mockneat/unit/text/Markovs.java +++ b/src/main/java/net/andreinc/mockneat/unit/text/Markovs.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.text; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/text/Strings.java b/src/main/java/net/andreinc/mockneat/unit/text/Strings.java index f614c85..64d929f 100644 --- a/src/main/java/net/andreinc/mockneat/unit/text/Strings.java +++ b/src/main/java/net/andreinc/mockneat/unit/text/Strings.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.text; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/text/markov/MarkovUnit.java b/src/main/java/net/andreinc/mockneat/unit/text/markov/MarkovUnit.java index c0c778f..5e99a6e 100644 --- a/src/main/java/net/andreinc/mockneat/unit/text/markov/MarkovUnit.java +++ b/src/main/java/net/andreinc/mockneat/unit/text/markov/MarkovUnit.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.text.markov; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/time/LocalDates.java b/src/main/java/net/andreinc/mockneat/unit/time/LocalDates.java index bb0b1a2..15caa51 100644 --- a/src/main/java/net/andreinc/mockneat/unit/time/LocalDates.java +++ b/src/main/java/net/andreinc/mockneat/unit/time/LocalDates.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.time; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/types/Chars.java b/src/main/java/net/andreinc/mockneat/unit/types/Chars.java index 77157c3..d38173a 100644 --- a/src/main/java/net/andreinc/mockneat/unit/types/Chars.java +++ b/src/main/java/net/andreinc/mockneat/unit/types/Chars.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.types; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/user/Passwords.java b/src/main/java/net/andreinc/mockneat/unit/user/Passwords.java index d875812..255f019 100644 --- a/src/main/java/net/andreinc/mockneat/unit/user/Passwords.java +++ b/src/main/java/net/andreinc/mockneat/unit/user/Passwords.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.user; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/unit/user/Users.java b/src/main/java/net/andreinc/mockneat/unit/user/Users.java index 7bbbff0..e83290b 100644 --- a/src/main/java/net/andreinc/mockneat/unit/user/Users.java +++ b/src/main/java/net/andreinc/mockneat/unit/user/Users.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.unit.user; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/utils/FormatUtils.java b/src/main/java/net/andreinc/mockneat/utils/FormatUtils.java index 7f70d9f..d61777c 100644 --- a/src/main/java/net/andreinc/mockneat/utils/FormatUtils.java +++ b/src/main/java/net/andreinc/mockneat/utils/FormatUtils.java @@ -1,10 +1,24 @@ package net.andreinc.mockneat.utils; -import static net.andreinc.mockneat.utils.LoopsUtils.loop; - /** - * Created by andreinicolinciobanu on 24/03/17. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + +import static net.andreinc.mockneat.utils.LoopsUtils.loop; + public class FormatUtils { public static String prependZeroesToSize(String string, int size) { if (string.length()<size) { diff --git a/src/main/java/net/andreinc/mockneat/utils/LoopsUtils.java b/src/main/java/net/andreinc/mockneat/utils/LoopsUtils.java index 8b5ad01..95421d9 100644 --- a/src/main/java/net/andreinc/mockneat/utils/LoopsUtils.java +++ b/src/main/java/net/andreinc/mockneat/utils/LoopsUtils.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.utils; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/main/java/net/andreinc/mockneat/utils/MockUnitUtils.java b/src/main/java/net/andreinc/mockneat/utils/MockUnitUtils.java index 8712d1c..7bc6fd1 100644 --- a/src/main/java/net/andreinc/mockneat/utils/MockUnitUtils.java +++ b/src/main/java/net/andreinc/mockneat/utils/MockUnitUtils.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.utils; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated @@ -20,12 +20,11 @@ import net.andreinc.mockneat.interfaces.MockUnit; import java.util.*; +import java.util.function.Function; import java.util.function.Supplier; import static net.andreinc.aleph.AlephFormatter.template; -import static net.andreinc.mockneat.utils.ValidationUtils.CANNOT_ADD_VALUE_TO_COLLECTION; -import static net.andreinc.mockneat.utils.ValidationUtils.CANNOT_ADD_VALUE_TO_LIST; -import static net.andreinc.mockneat.utils.ValidationUtils.CANNOT_ADD_VALUE_TO_SET; +import static net.andreinc.mockneat.utils.ValidationUtils.*; @SuppressWarnings("unchecked") public class MockUnitUtils { @@ -104,4 +103,13 @@ public static String listTypes(Object[] objs) { buff.append(")"); return buff.toString(); } + + public static <T, R> Supplier<R> ifSupplierNotNullDo(Supplier<T> supplier, Function<T, R> function) { + return () -> { + T val = supplier.get(); + if (null == val) return null; + return function.apply(val); + }; + } + } diff --git a/src/main/java/net/andreinc/mockneat/utils/SerialUtils.java b/src/main/java/net/andreinc/mockneat/utils/SerialUtils.java deleted file mode 100644 index 0db60b5..0000000 --- a/src/main/java/net/andreinc/mockneat/utils/SerialUtils.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.andreinc.mockneat.utils; - -/** - * Created by andreinicolinciobanu on 26/03/17. - */ -public class SerialUtils { - public static synchronized <T> void writeToDisk(String pathStr, T object) { - } -} diff --git a/src/main/java/net/andreinc/mockneat/utils/file/FileManager.java b/src/main/java/net/andreinc/mockneat/utils/file/FileManager.java index 6c6385d..c7f8e0b 100644 --- a/src/main/java/net/andreinc/mockneat/utils/file/FileManager.java +++ b/src/main/java/net/andreinc/mockneat/utils/file/FileManager.java @@ -1,6 +1,6 @@ package net.andreinc.mockneat.utils.file; -/* +/** * Copyright 2017, Andrei N. Ciobanu Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated diff --git a/src/test/java/net/andreinc/mockneat/Constants.java b/src/test/java/net/andreinc/mockneat/Constants.java index 64f0098..c5ed055 100644 --- a/src/test/java/net/andreinc/mockneat/Constants.java +++ b/src/test/java/net/andreinc/mockneat/Constants.java @@ -1,12 +1,26 @@ package net.andreinc.mockneat; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import static net.andreinc.mockneat.MockNeat.old; import static net.andreinc.mockneat.MockNeat.secure; import static net.andreinc.mockneat.MockNeat.threadLocal; -/** - * Created by andreinicolinciobanu on 30/12/2016. - */ public class Constants { public static final MockNeat[] MOCKS = { old(), secure(), threadLocal() }; diff --git a/src/test/java/net/andreinc/mockneat/MockFromFunctionsTest.java b/src/test/java/net/andreinc/mockneat/MockFromFunctionsTest.java index c286276..bb5198b 100644 --- a/src/test/java/net/andreinc/mockneat/MockFromFunctionsTest.java +++ b/src/test/java/net/andreinc/mockneat/MockFromFunctionsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.interfaces.MockUnitDouble; import net.andreinc.mockneat.interfaces.MockUnitInt; import net.andreinc.mockneat.interfaces.MockUnitLong; diff --git a/src/test/java/net/andreinc/mockneat/interfaces/MockConstValueTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockConstValueTest.java index beda038..4901f74 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/MockConstValueTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockConstValueTest.java @@ -1,14 +1,28 @@ package net.andreinc.mockneat.interfaces; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.interfaces.models.ToString; import org.junit.Test; import static net.andreinc.mockneat.interfaces.MockConstValue.constant; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 05/03/2017. - */ public class MockConstValueTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitArrayMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitArrayMethodTest.java similarity index 61% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitArrayMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitArrayMethodTest.java index 9a4e022..95ec471 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitArrayMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitArrayMethodTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.interfaces.models.ClassicPojo; import net.andreinc.mockneat.Constants; @@ -11,9 +28,6 @@ import static org.apache.commons.lang3.StringUtils.isAlphanumeric; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 07/03/2017. - */ public class MockUnitArrayMethodTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitCollectionMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitCollectionMethodTest.java similarity index 80% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitCollectionMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitCollectionMethodTest.java index 5b20779..ff95edd 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitCollectionMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitCollectionMethodTest.java @@ -1,5 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.interfaces.MockUnit; @@ -13,9 +29,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 10/02/2017. - */ public class MockUnitCollectionMethodTest { @Test(expected = NullPointerException.class) public void testCollectionNulLType() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitdays/MockUnitDaysTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitDaysTest.java similarity index 70% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitdays/MockUnitDaysTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitDaysTest.java index 1b4bcc3..8077cf4 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitdays/MockUnitDaysTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitDaysTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitdays; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import org.junit.Test; @@ -11,9 +28,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 07/03/2017. - */ public class MockUnitDaysTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitdouble/MockUnitDoubleTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitDoubleTest.java similarity index 67% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitdouble/MockUnitDoubleTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitDoubleTest.java index 0098ad2..b34c8ae 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitdouble/MockUnitDoubleTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitDoubleTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitdouble; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import org.junit.Test; @@ -9,10 +26,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; - -/** - * Created by andreinicolinciobanu on 07/03/2017. - */ public class MockUnitDoubleTest { @Test public void testDoubleStream() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/interfaces/MockUnitGenericComposeTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitGenericComposeTest.java new file mode 100644 index 0000000..2b69914 --- /dev/null +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitGenericComposeTest.java @@ -0,0 +1,40 @@ +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + +import net.andreinc.mockneat.Constants; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class MockUnitGenericComposeTest { + + @Test(expected = NullPointerException.class) + public void testConsumerNullConsumer() throws Exception { + Constants.M.ints().range(0, 100).consume(null); + } + + @Test + public void testConsume1() throws Exception { + final StringBuilder buff = new StringBuilder(); + Constants.M.intSeq().list(10).consume(l -> + l.forEach(e -> buff.append(e))); + assertTrue("0123456789" + .equals(buff.toString())); + } +} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitint/MockUnitIntTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitIntTest.java similarity index 60% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitint/MockUnitIntTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitIntTest.java index 7358891..4e15387 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitint/MockUnitIntTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitIntTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitint; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.Constants; import org.junit.Test; @@ -9,9 +26,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 07/03/2017. - */ public class MockUnitIntTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitListMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitListMethodTest.java similarity index 78% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitListMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitListMethodTest.java index 4c481e8..d8cc55a 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitListMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitListMethodTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.interfaces.MockUnit; import net.andreinc.mockneat.interfaces.models.AbstractListNoInstance; @@ -15,9 +32,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 10/02/2017. - */ public class MockUnitListMethodTest { diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapKeysMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapKeysMethodTest.java similarity index 92% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapKeysMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapKeysMethodTest.java index 8e47be8..92ba2ec 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapKeysMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapKeysMethodTest.java @@ -1,10 +1,24 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import junit.framework.Assert; import net.andreinc.mockneat.Constants; -import net.andreinc.mockneat.interfaces.MockUnit; -import net.andreinc.mockneat.interfaces.MockUnitInt; -import net.andreinc.mockneat.interfaces.MockUnitString; import net.andreinc.mockneat.interfaces.models.AbstractMapNoInstance; import net.andreinc.mockneat.utils.MapCheckUtils; import org.junit.Test; @@ -15,9 +29,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -/** - * Created by andreinicolinciobanu on 16/02/2017. - */ public class MockUnitMapKeysMethodTest { /*---------------------------------- diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapMethodTest.java similarity index 71% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapMethodTest.java index 21b95d6..f843435 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapMethodTest.java @@ -1,5 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.interfaces.MockUnit; @@ -11,9 +27,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 13/02/2017. - */ public class MockUnitMapMethodTest { @Test public void testMapToIntInts() { diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapValsMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapValsMethodTest.java similarity index 92% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapValsMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapValsMethodTest.java index a1c8ed1..e5a35d0 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitMapValsMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitMapValsMethodTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.interfaces.MockUnitInt; @@ -11,9 +28,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 06/03/2017. - */ public class MockUnitMapValsMethodTest { /* Test: diff --git a/src/test/java/net/andreinc/mockneat/interfaces/MockUnitSerializeTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitSerializeTest.java new file mode 100644 index 0000000..8980b84 --- /dev/null +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitSerializeTest.java @@ -0,0 +1,76 @@ +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + +import net.andreinc.mockneat.interfaces.models.ClassicPojo; +import org.junit.Test; + +import java.io.File; +import java.io.FileInputStream; +import java.util.List; + +import static java.util.stream.IntStream.range; +import static net.andreinc.mockneat.Constants.M; +import static org.apache.commons.lang3.SerializationUtils.deserialize; +import static org.junit.Assert.assertTrue; + +public class MockUnitSerializeTest { + + @Test + public void testSerializeInteger() throws Exception { + String randomFileName = M.strings().size(36).val(); + M.ints().bound(10).serialize(randomFileName); + + Integer x = deserialize(new FileInputStream(randomFileName)); + assertTrue(x >= 0 && x < 10); + + new File(randomFileName).delete(); + } + + @Test + public void testSerializeList() throws Exception { + String randomFileName = M.strings().size(36).val(); + M.intSeq().list(100).serialize(randomFileName); + + List<Integer> list = deserialize(new FileInputStream(randomFileName)); + + assertTrue(list != null); + assertTrue( list.size() == 100); + assertTrue(list.get(0) == 0); + range(0, list.size()).forEach(i -> assertTrue(list.get(i) == i)); + + new File(randomFileName).delete(); + } + + @Test + public void testSerializeBean() throws Exception { + String randomFileName = M.strings().size(36).val(); + + M.reflect(ClassicPojo.class) + .useDefaults(true) + .list(100) + .serialize(randomFileName); + + List<ClassicPojo> list = deserialize(new FileInputStream(randomFileName)); + + assertTrue(list!=null); + assertTrue(list.size() == 100); + + new File(randomFileName).delete(); + } +} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitSetMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitSetMethodTest.java similarity index 76% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitSetMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitSetMethodTest.java index bf5410f..beb56f3 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitSetMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitSetMethodTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.interfaces.MockUnit; import net.andreinc.mockneat.interfaces.models.AbstractSetNoInstance; @@ -12,9 +29,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 05/03/2017. - */ public class MockUnitSetMethodTest { @Test(expected = NullPointerException.class) public void testSetNullType() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/interfaces/MockUnitStringTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitStringTest.java new file mode 100644 index 0000000..989c923 --- /dev/null +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitStringTest.java @@ -0,0 +1,177 @@ +package net.andreinc.mockneat.interfaces; + +import net.andreinc.mockneat.types.enums.StringFormatType; +import org.junit.Test; + +import static net.andreinc.mockneat.Constants.*; +import static net.andreinc.mockneat.types.enums.StringType.LETTERS; +import static net.andreinc.mockneat.utils.LoopsUtils.loop; +import static org.apache.commons.lang3.StringUtils.isAllLowerCase; +import static org.apache.commons.lang3.StringUtils.isAllUpperCase; +import static org.junit.Assert.*; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + +public class MockUnitStringTest { + + @Test(expected = NullPointerException.class) + public void testFormatNull() throws Exception { + M.strings().format(null).val(); + } + + @Test + public void testFormats() { + loop( + STRING_CYCLES, MOCKS, + m -> { + StringFormatType type = m.from(StringFormatType.class).val(); + String result = m.strings().type(LETTERS).format(type).val(); + + assertTrue(result != null); + + switch (type) { + case CAPITALIZED: { assertTrue(Character.isUpperCase(result.charAt(0))); break; } + case LOWER_CASE: { assertTrue(isAllLowerCase(result)); break; } + case UPPER_CASE: { assertTrue(isAllUpperCase(result)); break; } + } + } + ); + } + + @Test + public void testSubString() { + String[] testString = { "TEST1" }; + + String t1 = M.from(testString).mapToString().sub(0, 1).val(); + + assertTrue(t1!=null); + assertTrue(t1.equals("T")); + + String t2 = M.from(testString).mapToString().sub(1, 2).val(); + + assertTrue(t2 != null); + assertTrue(t2.equals("E")); + + String t3 = M.from(testString).mapToString().sub(0, 5).val(); + assertTrue(t3 != null); + assertTrue(t3.equals("TEST1")); + + String t4 = M.from(testString).mapToString().sub(3).val(); + assertTrue(t4 != null); + assertTrue(t4.equals("TES")); + } + + @Test(expected = StringIndexOutOfBoundsException.class) + public void testSubStringInvalidIndex() throws Exception { + String[] testString = { "TEST1" }; + M.from(testString).mapToString().sub(-1, -5).val(); + } + + @Test(expected = NullPointerException.class) + public void testAppendNull() throws Exception { + String[] testString = { "A" }; + M.from(testString).mapToString().append(null).append("4").val(); + } + + @Test + public void testAppend() throws Exception { + String c = M.strings().size(5).append("A").append("B").val(); + assertTrue(c.endsWith("AB")); + } + + @Test(expected = NullPointerException.class) + public void testPrependNull() throws Exception { + M.strings().prepend(null).val(); + } + + @Test + public void testPrepend() throws Exception { + String c = M.strings().size(5).prepend("A").prepend("B").val(); + assertTrue(c.startsWith("BA")); + } + + @Test + public void testReplaceChrs() throws Exception { + String[] strs = { "aaa", "aab", "aac", "aa1" }; + + M.from(strs) + .mapToString() + .replace('a', 'x') + .stream().val() + .limit(STRING_CYCLES) + .forEach(s -> assertTrue(s.startsWith("xx"))); + } + + @Test + public void testReplaceStr() throws Exception { + M.regex("AB[0-9][0-9]CD") + .replace("AB", "AC") + .stream().val() + .limit(STRING_CYCLES) + .forEach(s -> assertTrue(s.startsWith("AC"))); + } + + @Test(expected = NullPointerException.class) + public void testReplaceStrNullTarget() throws Exception { + M.strings().replace(null, "B").val(); + } + + @Test + public void testReplaceAll() throws Exception { + M.regex("A[0-9]A[1-5]A[a-z]") + .replaceAll("A", "X") + .stream().val() + .limit(STRING_CYCLES) + .forEach(s -> { + assertTrue(s.charAt(0) == 'X'); + assertTrue(s.charAt(2) == 'X'); + assertTrue(s.charAt(4) == 'X'); + }); + } + + @Test + public void testReplaceFirst() throws Exception { + M.regex("A[0-9][abc]A") + .replaceFirst("A", "B") + .stream().val() + .limit(STRING_CYCLES) + .forEach(s -> { + assertTrue(s.charAt(0) == 'B'); + assertTrue(s.charAt(3) == 'A'); + }); + } + + @Test + public void testSplitNull() throws Exception { + String[] s = { null }; + assertNull(M.from(s).mapToString().split("\\.").val()); + } + + @Test + public void testSplit() throws Exception { + loop( + MOCK_CYCLES, + MOCKS, + m -> m.regex("[a-z];[a-z];[a-z]").split(";").val(), + arr -> { + assertNotNull(arr); + assertTrue(arr.length == 3); + } + ); + } +} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValMethodTest.java new file mode 100644 index 0000000..5da3f4a --- /dev/null +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValMethodTest.java @@ -0,0 +1,38 @@ +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + +import net.andreinc.mockneat.Constants; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class MockUnitValMethodTest { + + @Test(expected = NullPointerException.class) + public void testValFunctionNullFunction() throws Exception { + Constants.M.ints().val(null); + } + + + @Test + public void testValFunction() throws Exception { + String zero = Constants.M.ints().range(0, 1).val(i -> i.toString()); + assertTrue("0".equals(zero)); + } +} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValStrMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValStrMethodTest.java similarity index 68% rename from src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValStrMethodTest.java rename to src/test/java/net/andreinc/mockneat/interfaces/MockUnitValStrMethodTest.java index d95110f..9c62c46 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValStrMethodTest.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValStrMethodTest.java @@ -1,4 +1,21 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValueTest.java b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValueTest.java new file mode 100644 index 0000000..87c990b --- /dev/null +++ b/src/test/java/net/andreinc/mockneat/interfaces/MockUnitValueTest.java @@ -0,0 +1,49 @@ +package net.andreinc.mockneat.interfaces; + +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + +import net.andreinc.mockneat.Constants; +import org.junit.Test; + +import static java.time.DayOfWeek.TUESDAY; +import static net.andreinc.mockneat.interfaces.MockUnitValue.unit; +import static org.junit.Assert.assertTrue; + +public class MockUnitValueTest { + + @Test + public void testGet() throws Exception { + MockUnitInt m = Constants.M.ints().range(0, 5); + MockUnitValue muv = unit(m); + + Object o = muv.get(); + assertTrue(o instanceof Integer); + + Integer i = (Integer) o; + assertTrue(0<=i && i < 5); + } + + @Test + public void testGetStr() throws Exception { + MockUnitDays m = Constants.M.days().before(TUESDAY); + MockUnitValue muv = unit(m); + + String monday = muv.getStr(); + assertTrue(monday.equals("MONDAY")); + } +} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitGenericComposeTest.java b/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitGenericComposeTest.java deleted file mode 100644 index 5212bfa..0000000 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitGenericComposeTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; - -import net.andreinc.mockneat.Constants; -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -/** - * Created by andreinicolinciobanu on 28/02/2017. - */ -public class MockUnitGenericComposeTest { - - @Test(expected = NullPointerException.class) - public void testConsumerNullConsumer() throws Exception { - Constants.M.ints().range(0, 100).consume(null); - } - - @Test - public void testConsume1() throws Exception { - final StringBuilder buff = new StringBuilder(); - Constants.M.intSeq().list(10).consume(l -> - l.forEach(e -> buff.append(e))); - assertTrue("0123456789" - .equals(buff.toString())); - } -} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValMethodTest.java b/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValMethodTest.java deleted file mode 100644 index cd246e5..0000000 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValMethodTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; - - -import net.andreinc.mockneat.Constants; -import org.junit.Test; - -import static org.junit.Assert.assertTrue; - -public class MockUnitValMethodTest { - - @Test(expected = NullPointerException.class) - public void testValFunctionNullFunction() throws Exception { - Constants.M.ints().val(null); - } - - - @Test - public void testValFunction() throws Exception { - String zero = Constants.M.ints().range(0, 1).val(i -> i.toString()); - assertTrue("0".equals(zero)); - } -} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValueTest.java b/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValueTest.java deleted file mode 100644 index 847d5c5..0000000 --- a/src/test/java/net/andreinc/mockneat/interfaces/mockunitgeneric/MockUnitValueTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package net.andreinc.mockneat.interfaces.mockunitgeneric; - -import net.andreinc.mockneat.Constants; -import net.andreinc.mockneat.interfaces.MockUnitDays; -import net.andreinc.mockneat.interfaces.MockUnitInt; -import net.andreinc.mockneat.interfaces.MockUnitValue; -import org.junit.Test; - -import static java.time.DayOfWeek.TUESDAY; -import static net.andreinc.mockneat.interfaces.MockUnitValue.unit; -import static org.junit.Assert.assertTrue; - -/** - * Created by andreinicolinciobanu on 05/03/2017. - */ -public class MockUnitValueTest { - - @Test - public void testGet() throws Exception { - MockUnitInt m = Constants.M.ints().range(0, 5); - MockUnitValue muv = unit(m); - - Object o = muv.get(); - assertTrue(o instanceof Integer); - - Integer i = (Integer) o; - assertTrue(0<=i && i < 5); - } - - @Test - public void testGetStr() throws Exception { - MockUnitDays m = Constants.M.days().before(TUESDAY); - MockUnitValue muv = unit(m); - - String monday = muv.getStr(); - assertTrue(monday.equals("MONDAY")); - } -} diff --git a/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractListNoInstance.java b/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractListNoInstance.java index 794614a..a682779 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractListNoInstance.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractListNoInstance.java @@ -1,9 +1,23 @@ package net.andreinc.mockneat.interfaces.models; -import java.util.List; - /** - * Created by andreinicolinciobanu on 05/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + +import java.util.List; + public abstract class AbstractListNoInstance<T> implements List<T> { } diff --git a/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractMapNoInstance.java b/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractMapNoInstance.java index cd45a04..f2e4b47 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractMapNoInstance.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractMapNoInstance.java @@ -1,9 +1,23 @@ package net.andreinc.mockneat.interfaces.models; -import java.util.Map; - /** - * Created by andreinicolinciobanu on 05/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + +import java.util.Map; + public abstract class AbstractMapNoInstance<K,V> implements Map<K,V> { } diff --git a/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractSetNoInstance.java b/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractSetNoInstance.java index 0e302ab..dab326e 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractSetNoInstance.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/models/AbstractSetNoInstance.java @@ -1,9 +1,23 @@ package net.andreinc.mockneat.interfaces.models; -import java.util.Set; - /** - * Created by andreinicolinciobanu on 05/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + +import java.util.Set; + public abstract class AbstractSetNoInstance<T> implements Set<T> { } diff --git a/src/test/java/net/andreinc/mockneat/interfaces/models/ClassicPojo.java b/src/test/java/net/andreinc/mockneat/interfaces/models/ClassicPojo.java index fd5e132..d5139e7 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/models/ClassicPojo.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/models/ClassicPojo.java @@ -1,13 +1,31 @@ package net.andreinc.mockneat.interfaces.models; +import java.io.Serializable; + /** - * Created by andreinicolinciobanu on 07/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ -public class ClassicPojo { + +public class ClassicPojo implements Serializable { public String name; public Integer age; + public ClassicPojo() {} + public ClassicPojo(String name, Integer age) { this.name = name; this.age = age; diff --git a/src/test/java/net/andreinc/mockneat/interfaces/models/ToString.java b/src/test/java/net/andreinc/mockneat/interfaces/models/ToString.java index 63c98b2..ba7f23a 100644 --- a/src/test/java/net/andreinc/mockneat/interfaces/models/ToString.java +++ b/src/test/java/net/andreinc/mockneat/interfaces/models/ToString.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.interfaces.models; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + public class ToString { public static final String CONST = "123456"; @Override diff --git a/src/test/java/net/andreinc/mockneat/unit/address/CountriesTest.java b/src/test/java/net/andreinc/mockneat/unit/address/CountriesTest.java index 5f5f50c..4eee8a2 100644 --- a/src/test/java/net/andreinc/mockneat/unit/address/CountriesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/address/CountriesTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.address; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.utils.file.FileManager; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/companies/DepartmentsTest.java b/src/test/java/net/andreinc/mockneat/unit/companies/DepartmentsTest.java index 0d887e9..118e059 100644 --- a/src/test/java/net/andreinc/mockneat/unit/companies/DepartmentsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/companies/DepartmentsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.companies; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.utils.file.FileManager; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/financial/CVVSTest.java b/src/test/java/net/andreinc/mockneat/unit/financial/CVVSTest.java index b1fd913..ef93db3 100644 --- a/src/test/java/net/andreinc/mockneat/unit/financial/CVVSTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/financial/CVVSTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.financial; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/financial/CreditCardsTest.java b/src/test/java/net/andreinc/mockneat/unit/financial/CreditCardsTest.java index 634d326..fc04618 100644 --- a/src/test/java/net/andreinc/mockneat/unit/financial/CreditCardsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/financial/CreditCardsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.financial; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.types.enums.CreditCardType; import net.andreinc.mockneat.utils.LuhnUtils; diff --git a/src/test/java/net/andreinc/mockneat/unit/financial/CurrenciesTest.java b/src/test/java/net/andreinc/mockneat/unit/financial/CurrenciesTest.java index 466266d..64470be 100644 --- a/src/test/java/net/andreinc/mockneat/unit/financial/CurrenciesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/financial/CurrenciesTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.financial; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.CurrencySymbolType; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/financial/IBANsTest.java b/src/test/java/net/andreinc/mockneat/unit/financial/IBANsTest.java index f01a441..d665def 100644 --- a/src/test/java/net/andreinc/mockneat/unit/financial/IBANsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/financial/IBANsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.financial; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.IBANType; import org.apache.commons.validator.routines.checkdigit.IBANCheckDigit; import org.junit.Test; @@ -8,9 +25,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 08/05/17. - */ public class IBANsTest { private static final IBANCheckDigit ICD = new IBANCheckDigit(); diff --git a/src/test/java/net/andreinc/mockneat/unit/financial/MoneyTest.java b/src/test/java/net/andreinc/mockneat/unit/financial/MoneyTest.java index 6477216..bb0d0d1 100644 --- a/src/test/java/net/andreinc/mockneat/unit/financial/MoneyTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/financial/MoneyTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.financial; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import java.text.NumberFormat; @@ -15,9 +32,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -/** - * Created by andreinicolinciobanu on 21/02/2017. - */ public class MoneyTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/unit/hashes/MD2sTest.java b/src/test/java/net/andreinc/mockneat/unit/hashes/MD2sTest.java index 882bce1..e5f82d2 100644 --- a/src/test/java/net/andreinc/mockneat/unit/hashes/MD2sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/hashes/MD2sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.HASH_CYCLES; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class MD2sTest { @Test public void testMD2sHash() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/hashes/MD5sTest.java b/src/test/java/net/andreinc/mockneat/unit/hashes/MD5sTest.java index 5a6f3d2..cbeea71 100644 --- a/src/test/java/net/andreinc/mockneat/unit/hashes/MD5sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/hashes/MD5sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.HASH_CYCLES; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class MD5sTest { @Test public void testMD5sHash() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA1sTest.java b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA1sTest.java index 1955583..c175795 100644 --- a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA1sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA1sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.HASH_CYCLES; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class SHA1sTest { @Test public void testSHA1sHash() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA256sTest.java b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA256sTest.java index c9aa1a3..f86690f 100644 --- a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA256sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA256sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.HASH_CYCLES; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class SHA256sTest { @Test public void testSHA256sHash() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA384sTest.java b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA384sTest.java index ba32ec9..1811487 100644 --- a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA384sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA384sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.HASH_CYCLES; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class SHA384sTest { @Test public void testSHA384sHash() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA512sTest.java b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA512sTest.java index ff6e95e..1418b45 100644 --- a/src/test/java/net/andreinc/mockneat/unit/hashes/SHA512sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/hashes/SHA512sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.hashes; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Assert; import org.junit.Test; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.Constants.MOCKS; import static net.andreinc.mockneat.utils.LoopsUtils.loop; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class SHA512sTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/unit/misc/ISSNSTest.java b/src/test/java/net/andreinc/mockneat/unit/misc/ISSNSTest.java index 1707489..3f6ed1c 100644 --- a/src/test/java/net/andreinc/mockneat/unit/misc/ISSNSTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/misc/ISSNSTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.misc; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.apache.commons.validator.routines.ISSNValidator; import org.junit.Test; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 26/03/17. - */ public class ISSNSTest { private ISSNValidator validator = ISSNValidator.getInstance(); @@ -17,7 +31,6 @@ public class ISSNSTest { @Test public void test() throws Exception { loop( - true, ISSNS_CYCLES, MOCKS, m -> m.issns().val(), diff --git a/src/test/java/net/andreinc/mockneat/unit/misc/SSCsTest.java b/src/test/java/net/andreinc/mockneat/unit/misc/SSCsTest.java index e81bb66..1669c0c 100644 --- a/src/test/java/net/andreinc/mockneat/unit/misc/SSCsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/misc/SSCsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.misc; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.MOCKS; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 24/03/17. - */ public class SSCsTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/unit/networking/DomainsTest.java b/src/test/java/net/andreinc/mockneat/unit/networking/DomainsTest.java index cea37f3..5d5397c 100644 --- a/src/test/java/net/andreinc/mockneat/unit/networking/DomainsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/networking/DomainsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.networking; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.DomainSuffixType; import net.andreinc.mockneat.utils.file.FileManager; import org.junit.Test; @@ -14,9 +31,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 21/02/2017. - */ public class DomainsTest { public static final FileManager FM = FileManager.getInstance(); diff --git a/src/test/java/net/andreinc/mockneat/unit/networking/IPv4sTest.java b/src/test/java/net/andreinc/mockneat/unit/networking/IPv4sTest.java index f44946c..834d6b1 100644 --- a/src/test/java/net/andreinc/mockneat/unit/networking/IPv4sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/networking/IPv4sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.networking; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import junit.framework.Assert; import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.types.Range; diff --git a/src/test/java/net/andreinc/mockneat/unit/networking/IPv6sTest.java b/src/test/java/net/andreinc/mockneat/unit/networking/IPv6sTest.java index bf2fb18..32526c6 100644 --- a/src/test/java/net/andreinc/mockneat/unit/networking/IPv6sTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/networking/IPv6sTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.networking; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.apache.commons.validator.routines.InetAddressValidator; import org.junit.Test; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 21/02/2017. - */ public class IPv6sTest { private static final InetAddressValidator IAV = new InetAddressValidator(); diff --git a/src/test/java/net/andreinc/mockneat/unit/networking/MacsTest.java b/src/test/java/net/andreinc/mockneat/unit/networking/MacsTest.java index f66dad1..c733114 100644 --- a/src/test/java/net/andreinc/mockneat/unit/networking/MacsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/networking/MacsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.networking; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import junit.framework.Assert; import net.andreinc.mockneat.types.enums.MACAddressFormatType; import org.junit.Test; @@ -10,9 +27,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 05/02/2017. - */ public class MacsTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/networking/URLsTest.java b/src/test/java/net/andreinc/mockneat/unit/networking/URLsTest.java index 8636ee9..908acd5 100644 --- a/src/test/java/net/andreinc/mockneat/unit/networking/URLsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/networking/URLsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.networking; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.DomainSuffixType; import net.andreinc.mockneat.types.enums.HostNameType; import net.andreinc.mockneat.types.enums.URLSchemeType; diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/ConstructorTest.java b/src/test/java/net/andreinc/mockneat/unit/objects/ConstructorTest.java index d2d4770..b900c86 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/ConstructorTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/ConstructorTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.unit.objects.model.MultipleConstructors; import org.junit.Test; @@ -13,9 +30,6 @@ import static org.apache.commons.lang3.StringUtils.isNumeric; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 08/03/2017. - */ public class ConstructorTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/FactoryTest.java b/src/test/java/net/andreinc/mockneat/unit/objects/FactoryTest.java index 5590da3..71aeb6d 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/FactoryTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/FactoryTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.types.enums.StringType; import net.andreinc.mockneat.unit.objects.model.FactoryMethods; @@ -9,9 +26,6 @@ import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 08/03/2017. - */ public class FactoryTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/ProbabilitiesTest.java b/src/test/java/net/andreinc/mockneat/unit/objects/ProbabilitiesTest.java index 20847eb..a642189 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/ProbabilitiesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/ProbabilitiesTest.java @@ -1,12 +1,26 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.M; -/** - * Created by andreinicolinciobanu on 06/05/17. - */ public class ProbabilitiesTest { @Test(expected = IllegalArgumentException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/ReflectTest.java b/src/test/java/net/andreinc/mockneat/unit/objects/ReflectTest.java index bedec3e..1a377e1 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/ReflectTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/ReflectTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.unit.objects.model.Customer1; import net.andreinc.mockneat.unit.objects.model.FinalValue; import net.andreinc.mockneat.unit.objects.model.TheAbstractClass; diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/ShufflersTest.java b/src/test/java/net/andreinc/mockneat/unit/objects/ShufflersTest.java index 42d007e..16f0a96 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/ShufflersTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/ShufflersTest.java @@ -1,14 +1,29 @@ package net.andreinc.mockneat.unit.objects; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.unit.objects.model.SimpleBean; import org.junit.Test; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; +import java.util.*; import static java.util.Arrays.asList; +import static java.util.Arrays.sort; import static java.util.stream.Collectors.toSet; import static java.util.stream.IntStream.range; import static net.andreinc.mockneat.Constants.*; @@ -18,6 +33,19 @@ public class ShufflersTest { + private static boolean areAnagrams(String s1, String s2) { + if (s1.length() != s2.length()) + return false; + + char[] s1c = s1.toCharArray(); + char[] s2c = s2.toCharArray(); + + sort(s1c); + sort(s2c); + + return Objects.deepEquals(s1c, s2c); + } + @Test(expected = NullPointerException.class) public void testGenericArrayNullSource() throws Exception { M.shufflers().array(null).val(); @@ -336,4 +364,34 @@ public void testArrayListArray() throws Exception { } ); } + + @Test(expected = NullPointerException.class) + public void testStringNull() throws Exception { + M.shufflers().string(null).val(); + } + + @Test + public void testStringEmpty() throws Exception { + String s1 = ""; + String s2 = M.shufflers().string(s1).val(); + assertTrue(s2 != null); + assertTrue( s2.length() == 0); + assertTrue(s1.equals(s2)); + } + + @Test + public void testString() throws Exception { + loop( + SHUFFLED_CYCLES, + MOCKS, + m -> { + String s = m.strings().size(32).val(); + String shuffled = m.shufflers().string(s).val(); + + assertTrue(shuffled!=null); + assertTrue(s.length() == shuffled.length()); + assertTrue(areAnagrams(s, shuffled)); + } + ); + } } diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/model/Customer1.java b/src/test/java/net/andreinc/mockneat/unit/objects/model/Customer1.java index d757b75..14394ac 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/model/Customer1.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/model/Customer1.java @@ -1,10 +1,24 @@ package net.andreinc.mockneat.unit.objects.model; -import java.time.LocalDate; - /** - * Created by andreinicolinciobanu on 26/02/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + +import java.time.LocalDate; + public class Customer1 { private String firstName; private String lastName; diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/model/FactoryMethods.java b/src/test/java/net/andreinc/mockneat/unit/objects/model/FactoryMethods.java index 98327d4..00387b4 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/model/FactoryMethods.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/model/FactoryMethods.java @@ -1,8 +1,22 @@ package net.andreinc.mockneat.unit.objects.model; /** - * Created by andreinicolinciobanu on 08/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + public class FactoryMethods { public static StringBuilder buffBuilder(String val) { diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/model/FinalValue.java b/src/test/java/net/andreinc/mockneat/unit/objects/model/FinalValue.java index 0d7779d..f7fbda6 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/model/FinalValue.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/model/FinalValue.java @@ -1,8 +1,22 @@ package net.andreinc.mockneat.unit.objects.model; /** - * Created by andreinicolinciobanu on 08/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + public class FinalValue { private final String name = "Hello"; diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/model/MultipleConstructors.java b/src/test/java/net/andreinc/mockneat/unit/objects/model/MultipleConstructors.java index e4a99b4..65836e3 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/model/MultipleConstructors.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/model/MultipleConstructors.java @@ -1,8 +1,22 @@ package net.andreinc.mockneat.unit.objects.model; /** - * Created by andreinicolinciobanu on 08/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + public class MultipleConstructors { private String x; private String y; diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/model/SimpleBean.java b/src/test/java/net/andreinc/mockneat/unit/objects/model/SimpleBean.java index f40b09d..552b4e1 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/model/SimpleBean.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/model/SimpleBean.java @@ -1,10 +1,24 @@ package net.andreinc.mockneat.unit.objects.model; -import java.util.Objects; - /** - * Created by andreinicolinciobanu on 08/05/17. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + +import java.util.Objects; + public class SimpleBean { private String s; diff --git a/src/test/java/net/andreinc/mockneat/unit/objects/model/TheAbstractClass.java b/src/test/java/net/andreinc/mockneat/unit/objects/model/TheAbstractClass.java index 0a48cca..8bbc0d6 100644 --- a/src/test/java/net/andreinc/mockneat/unit/objects/model/TheAbstractClass.java +++ b/src/test/java/net/andreinc/mockneat/unit/objects/model/TheAbstractClass.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.objects.model; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + public abstract class TheAbstractClass { private String name; diff --git a/src/test/java/net/andreinc/mockneat/unit/regex/RegexTest.java b/src/test/java/net/andreinc/mockneat/unit/regex/RegexTest.java index f87c7a1..20bb6b3 100644 --- a/src/test/java/net/andreinc/mockneat/unit/regex/RegexTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/regex/RegexTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.regex; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.*; diff --git a/src/test/java/net/andreinc/mockneat/unit/seq/IntSeqTest.java b/src/test/java/net/andreinc/mockneat/unit/seq/IntSeqTest.java index 553d45c..4a47dfe 100644 --- a/src/test/java/net/andreinc/mockneat/unit/seq/IntSeqTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/seq/IntSeqTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.seq; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/seq/LongSeqTest.java b/src/test/java/net/andreinc/mockneat/unit/seq/LongSeqTest.java index 02a49cf..00c3fd8 100644 --- a/src/test/java/net/andreinc/mockneat/unit/seq/LongSeqTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/seq/LongSeqTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.seq; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; @@ -9,9 +26,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 06/05/17. - */ public class LongSeqTest { @Test(expected = IllegalArgumentException.class) public void testConstructorMinBiggerMax() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/text/FormatterTest.java b/src/test/java/net/andreinc/mockneat/unit/text/FormatterTest.java index 33e15b4..7d2b54b 100644 --- a/src/test/java/net/andreinc/mockneat/unit/text/FormatterTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/text/FormatterTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.text; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.aleph.UncheckedFormatterException; import org.junit.Test; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 01/03/2017. - */ public class FormatterTest { @Test(expected = IllegalArgumentException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/text/FromFilesTest.java b/src/test/java/net/andreinc/mockneat/unit/text/FromFilesTest.java index 3f7ac23..207f224 100644 --- a/src/test/java/net/andreinc/mockneat/unit/text/FromFilesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/text/FromFilesTest.java @@ -1,47 +1,62 @@ package net.andreinc.mockneat.unit.text; -import net.andreinc.mockneat.Constants; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import java.io.IOException; -import java.nio.file.Files; import java.nio.file.Path; +import static java.nio.file.Files.createTempFile; +import static java.nio.file.Files.write; import static java.nio.file.StandardOpenOption.APPEND; +import static net.andreinc.mockneat.Constants.*; import static net.andreinc.mockneat.types.enums.StringType.LETTERS; import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -/** - * Created by andreinicolinciobanu on 05/03/2017. - */ public class FromFilesTest { @Test(expected = NullPointerException.class) public void testNullPath() throws Exception { - Constants.M.files().from(null).val(); + M.files().from(null).val(); } @Test(expected = IllegalArgumentException.class) public void testEmptyPath() throws Exception { - Constants.M.files().from("").val(); + M.files().from("").val(); } @Test public void testFiles() throws Exception { - String tmpFile = Constants.M.strings().size(32).type(LETTERS).val(); - String tmpFileExt = Constants.M.strings().size(3).type(LETTERS).val(); + String tmpFile = M.strings().size(32).type(LETTERS).val(); + String tmpFileExt = M.strings().size(3).type(LETTERS).val(); Path tmp = null; try { - tmp = Files.createTempFile(tmpFile, tmpFileExt); + tmp = createTempFile(tmpFile, tmpFileExt); tmp.toFile().deleteOnExit(); final String path = tmp.toFile().getPath(); // Writing content to disk - Files.write(tmp, Constants.M.ints().range(0, 100).mapToString().list(100).val(), APPEND); + write(tmp, M.ints().range(0, 100).mapToString().list(100).val(), APPEND); loop( - Constants.FILES_CYCLES, - Constants.MOCKS, + FILES_CYCLES, + MOCKS, m -> m.files().from(path).val(), l -> { Integer x = Integer.parseInt(l); diff --git a/src/test/java/net/andreinc/mockneat/unit/text/MarkovsTest.java b/src/test/java/net/andreinc/mockneat/unit/text/MarkovsTest.java index 84df371..1ff0389 100644 --- a/src/test/java/net/andreinc/mockneat/unit/text/MarkovsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/text/MarkovsTest.java @@ -1,5 +1,21 @@ package net.andreinc.mockneat.unit.text; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/text/StringsTest.java b/src/test/java/net/andreinc/mockneat/unit/text/StringsTest.java index 62efd76..659b143 100644 --- a/src/test/java/net/andreinc/mockneat/unit/text/StringsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/text/StringsTest.java @@ -1,5 +1,21 @@ package net.andreinc.mockneat.unit.text; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.alphabets.Alphabets; import net.andreinc.mockneat.types.enums.StringType; @@ -16,9 +32,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -/** - * Created by andreinicolinciobanu on 02/03/2017. - */ public class StringsTest { @Test(expected = IllegalArgumentException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/time/DaysTest.java b/src/test/java/net/andreinc/mockneat/unit/time/DaysTest.java index e3a3add..19e5a30 100644 --- a/src/test/java/net/andreinc/mockneat/unit/time/DaysTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/time/DaysTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.time; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; @@ -11,9 +28,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 16/02/2017. - */ public class DaysTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/unit/time/LocalDatesTest.java b/src/test/java/net/andreinc/mockneat/unit/time/LocalDatesTest.java index 2d6d013..ffd8199 100644 --- a/src/test/java/net/andreinc/mockneat/unit/time/LocalDatesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/time/LocalDatesTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.time; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; @@ -12,9 +29,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 28/02/2017. - */ public class LocalDatesTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/unit/time/MonthsTest.java b/src/test/java/net/andreinc/mockneat/unit/time/MonthsTest.java index 5748d3a..712e034 100644 --- a/src/test/java/net/andreinc/mockneat/unit/time/MonthsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/time/MonthsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.time; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import java.time.Month; @@ -14,9 +31,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 16/02/2017. - */ public class MonthsTest { @Test diff --git a/src/test/java/net/andreinc/mockneat/unit/types/BoolsTest.java b/src/test/java/net/andreinc/mockneat/unit/types/BoolsTest.java index a9b54ad..d67a641 100644 --- a/src/test/java/net/andreinc/mockneat/unit/types/BoolsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/types/BoolsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.types; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Test; import static net.andreinc.mockneat.Constants.*; diff --git a/src/test/java/net/andreinc/mockneat/unit/types/CharsTest.java b/src/test/java/net/andreinc/mockneat/unit/types/CharsTest.java index d10e10d..bf78974 100644 --- a/src/test/java/net/andreinc/mockneat/unit/types/CharsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/types/CharsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.types; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Assert; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/types/DoublesTest.java b/src/test/java/net/andreinc/mockneat/unit/types/DoublesTest.java index 8e95a6a..b886f36 100644 --- a/src/test/java/net/andreinc/mockneat/unit/types/DoublesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/types/DoublesTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.types; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/types/FloatsTest.java b/src/test/java/net/andreinc/mockneat/unit/types/FloatsTest.java index cf9cc74..3268784 100644 --- a/src/test/java/net/andreinc/mockneat/unit/types/FloatsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/types/FloatsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.types; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/types/IntsTest.java b/src/test/java/net/andreinc/mockneat/unit/types/IntsTest.java index ecba0f6..966d19b 100644 --- a/src/test/java/net/andreinc/mockneat/unit/types/IntsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/types/IntsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.types; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/types/LongsTest.java b/src/test/java/net/andreinc/mockneat/unit/types/LongsTest.java index eed7698..09902fa 100644 --- a/src/test/java/net/andreinc/mockneat/unit/types/LongsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/types/LongsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.types; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/user/EmailsTest.java b/src/test/java/net/andreinc/mockneat/unit/user/EmailsTest.java index d2545f8..f9ce10d 100644 --- a/src/test/java/net/andreinc/mockneat/unit/user/EmailsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/user/EmailsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.user; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.Constants; import org.junit.Test; diff --git a/src/test/java/net/andreinc/mockneat/unit/user/GendersTest.java b/src/test/java/net/andreinc/mockneat/unit/user/GendersTest.java index a2d671b..a15a741 100644 --- a/src/test/java/net/andreinc/mockneat/unit/user/GendersTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/user/GendersTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.user; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import org.junit.Assert; import org.junit.Test; @@ -7,9 +24,6 @@ import static net.andreinc.mockneat.Constants.MOCKS; import static net.andreinc.mockneat.utils.LoopsUtils.loop; -/** - * Created by andreinicolinciobanu on 25/03/17. - */ public class GendersTest { @Test public void testGendersLong() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/user/NamesTest.java b/src/test/java/net/andreinc/mockneat/unit/user/NamesTest.java index 355c803..249aa96 100644 --- a/src/test/java/net/andreinc/mockneat/unit/user/NamesTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/user/NamesTest.java @@ -1,5 +1,21 @@ package net.andreinc.mockneat.unit.user; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ import net.andreinc.mockneat.Constants; import net.andreinc.mockneat.types.enums.NameType; @@ -13,9 +29,6 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 28/02/2017. - */ public class NamesTest { @Test public void testNames() throws Exception { diff --git a/src/test/java/net/andreinc/mockneat/unit/user/PasswordsTest.java b/src/test/java/net/andreinc/mockneat/unit/user/PasswordsTest.java index be45378..1e9f9bc 100644 --- a/src/test/java/net/andreinc/mockneat/unit/user/PasswordsTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/user/PasswordsTest.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.unit.user; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.PassStrengthType; import org.junit.Test; @@ -14,9 +31,6 @@ import static net.andreinc.mockneat.utils.LoopsUtils.loop; import static org.junit.Assert.assertTrue; -/** - * Created by andreinicolinciobanu on 18/02/2017. - */ public class PasswordsTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java b/src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java index 5de0b99..5c25a51 100644 --- a/src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java +++ b/src/test/java/net/andreinc/mockneat/unit/user/UsersTest.java @@ -1,13 +1,27 @@ package net.andreinc.mockneat.unit.user; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.UserNameType; import org.junit.Test; import static net.andreinc.mockneat.Constants.M; -/** - * Created by andreinicolinciobanu on 18/02/2017. - */ public class UsersTest { @Test(expected = NullPointerException.class) diff --git a/src/test/java/net/andreinc/mockneat/utils/LuhnUtils.java b/src/test/java/net/andreinc/mockneat/utils/LuhnUtils.java index 3013629..ead8e87 100644 --- a/src/test/java/net/andreinc/mockneat/utils/LuhnUtils.java +++ b/src/test/java/net/andreinc/mockneat/utils/LuhnUtils.java @@ -1,5 +1,23 @@ package net.andreinc.mockneat.utils; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + + public class LuhnUtils { /** * Tests if a certain String is a valid Luhn number diff --git a/src/test/java/net/andreinc/mockneat/utils/MapCheckUtils.java b/src/test/java/net/andreinc/mockneat/utils/MapCheckUtils.java index c287c79..acffb01 100644 --- a/src/test/java/net/andreinc/mockneat/utils/MapCheckUtils.java +++ b/src/test/java/net/andreinc/mockneat/utils/MapCheckUtils.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.utils; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -9,9 +26,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -/** - * Created by andreinicolinciobanu on 06/03/2017. - */ public class MapCheckUtils { public static <K,V> void testMap(Map<K,V> map, Consumer<K> validateKeys, diff --git a/src/test/java/net/andreinc/mockneat/utils/NamesCheckUtils.java b/src/test/java/net/andreinc/mockneat/utils/NamesCheckUtils.java index a74777e..a2fb490 100644 --- a/src/test/java/net/andreinc/mockneat/utils/NamesCheckUtils.java +++ b/src/test/java/net/andreinc/mockneat/utils/NamesCheckUtils.java @@ -1,5 +1,22 @@ package net.andreinc.mockneat.utils; +/** + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. + */ + import net.andreinc.mockneat.types.enums.NameType; import net.andreinc.mockneat.utils.file.FileManager; @@ -7,8 +24,22 @@ import java.util.*; /** - * Created by andreinicolinciobanu on 02/03/2017. + * Copyright 2017, Andrei N. Ciobanu + + Permission is hereby granted, free of charge, to any user obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, FREE_TEXT OF OR PARAM CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS PARAM THE SOFTWARE. */ + public class NamesCheckUtils { private static FileManager FILE_MANAGER = FileManager.getInstance();