Class DefaultCouponCodeClearTextGenerationStrategyUnitTest
java.lang.Object
de.hybris.platform.couponservices.couponcodegeneration.impl.DefaultCouponCodeClearTextGenerationStrategyUnitTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckForDuplicateClearTextWithLength(int length, long seed) runs through all possible seed values with a default 16-char alphabet (based on clear-text length: length 2 --> 16^2 = 256, 16^4 = 65536 ...) and checks that for each distinct seed value the resulting cleartext doesn't lead to duplicates.protected voiddoTestClearTextGeneration(long couponCodeNumber, int length) protected voiddoTestGenerateAndInverseOperation(long start, long totalRuns, int clearTextLength) voidsetUp()voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoid
-
Constructor Details
-
DefaultCouponCodeClearTextGenerationStrategyUnitTest
public DefaultCouponCodeClearTextGenerationStrategyUnitTest()
-
-
Method Details
-
setUp
- Throws:
Exception
-
testWrongInputLengths
- Throws:
CouponCodeGenerationException
-
testGenerateAndInverseOperationForSpecialCases
- Throws:
CouponCodeGenerationException
-
doTestGenerateAndInverseOperation
protected void doTestGenerateAndInverseOperation(long start, long totalRuns, int clearTextLength) throws CouponCodeGenerationException - Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength2
public void testClearTextGenerationFailsWhenLimitIsReachedLength2() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength4
public void testClearTextGenerationFailsWhenLimitIsReachedLength4() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength6
public void testClearTextGenerationFailsWhenLimitIsReachedLength6() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationFailsWhenLimitIsReachedLength8
public void testClearTextGenerationFailsWhenLimitIsReachedLength8() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength2
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength2() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength4
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength4() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength6
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength6() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
testClearTextGenerationSucceedsBeforeLimitIsReachedLength8
public void testClearTextGenerationSucceedsBeforeLimitIsReachedLength8() throws CouponCodeGenerationException- Throws:
CouponCodeGenerationException
-
doTestClearTextGeneration
protected void doTestClearTextGeneration(long couponCodeNumber, int length) throws CouponCodeGenerationException - Throws:
CouponCodeGenerationException
-
testCodeForLength2
- Throws:
CouponCodeGenerationException
-
testCodeForLength4
- Throws:
CouponCodeGenerationException
-
testCodeForLength6
- Throws:
CouponCodeGenerationException
-
testCodeForLength8
- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength2
- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength4
- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength6
- Throws:
CouponCodeGenerationException
-
testNoClearTextDuplicatesLength8
- Throws:
CouponCodeGenerationException
-
checkForDuplicateClearTextWithLength
protected void checkForDuplicateClearTextWithLength(int length, long seed) throws CouponCodeGenerationException runs through all possible seed values with a default 16-char alphabet (based on clear-text length: length 2 --> 16^2 = 256, 16^4 = 65536 ...) and checks that for each distinct seed value the resulting cleartext doesn't lead to duplicates.- Throws:
CouponCodeGenerationException
-