Add project parent module
This commit is contained in:
11
src/main/java/com/cubetiqs/Constants.java
Normal file
11
src/main/java/com/cubetiqs/Constants.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.cubetiqs;
|
||||
|
||||
/**
|
||||
* Static Constants variable global use in sub-modules
|
||||
*
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
public class Constants {
|
||||
public static final String __$ = "CONSTANTS";
|
||||
}
|
||||
130
src/main/java/com/cubetiqs/assertion/Tests.java
Normal file
130
src/main/java/com/cubetiqs/assertion/Tests.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package com.cubetiqs.assertion;
|
||||
|
||||
/**
|
||||
* Assertion and Tests
|
||||
* This class used for check and validation and throwable error
|
||||
*
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
public final class Tests {
|
||||
public static void isTrue(boolean val) throws TestsException {
|
||||
assert val;
|
||||
}
|
||||
|
||||
public static void isTrue(boolean val, String message) throws TestsException {
|
||||
try {
|
||||
isTrue(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNotTrue(boolean val) throws TestsException {
|
||||
assert !val;
|
||||
}
|
||||
|
||||
public static void isNotTrue(boolean val, String message) throws TestsException {
|
||||
try {
|
||||
isNotTrue(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNull(Object val) throws TestsException {
|
||||
assert val == null;
|
||||
}
|
||||
|
||||
public static void isNull(Object val, String message) throws TestsException {
|
||||
try {
|
||||
isNull(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNotNull(Object val) throws TestsException {
|
||||
assert val != null;
|
||||
}
|
||||
|
||||
public static void isNotNull(Object val, String message) throws TestsException {
|
||||
try {
|
||||
isNotNull(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isEmpty(String val) throws TestsException {
|
||||
assert val.isEmpty();
|
||||
}
|
||||
|
||||
public static void isEmpty(String val, String message) throws TestsException {
|
||||
try {
|
||||
isEmpty(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNotEmpty(String val) throws TestsException {
|
||||
assert !val.isEmpty();
|
||||
}
|
||||
|
||||
public static void isNotEmpty(String val, String message) throws TestsException {
|
||||
try {
|
||||
isNotEmpty(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isBlank(String val) throws TestsException {
|
||||
assert val.trim().isEmpty();
|
||||
}
|
||||
|
||||
public static void isBlank(String val, String message) throws TestsException {
|
||||
try {
|
||||
isBlank(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNotBlank(String val) throws TestsException {
|
||||
assert !val.trim().isEmpty();
|
||||
}
|
||||
|
||||
public static void isNotBlank(String val, String message) throws TestsException {
|
||||
try {
|
||||
isNotBlank(val);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isEquals(Object val1, Object val2) throws TestsException {
|
||||
assert val1 == val2;
|
||||
}
|
||||
|
||||
public static void isEquals(Object val1, Object val2, String message) throws TestsException {
|
||||
try {
|
||||
isEquals(val1, val2);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void isNotEquals(Object val1, Object val2) throws TestsException {
|
||||
assert val1 != val2;
|
||||
}
|
||||
|
||||
public static void isNotEquals(Object val1, Object val2, String message) throws TestsException {
|
||||
try {
|
||||
isNotEquals(val1, val2);
|
||||
} catch (AssertionError error) {
|
||||
throw new TestsException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
24
src/main/java/com/cubetiqs/assertion/TestsException.java
Normal file
24
src/main/java/com/cubetiqs/assertion/TestsException.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.cubetiqs.assertion;
|
||||
|
||||
/**
|
||||
* Default Assertion/Tests Exception
|
||||
*
|
||||
* @author sombochea
|
||||
* @see AssertionError
|
||||
* @see Error
|
||||
* @see Throwable
|
||||
* @since 1.0
|
||||
*/
|
||||
public class TestsException extends AssertionError {
|
||||
public TestsException() {
|
||||
super("tests failed");
|
||||
}
|
||||
|
||||
public TestsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TestsException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
8
src/main/java/com/cubetiqs/event/EventContext.java
Normal file
8
src/main/java/com/cubetiqs/event/EventContext.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.cubetiqs.event;
|
||||
|
||||
/**
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
public interface EventContext {
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cubetiqs.exception;
|
||||
|
||||
/**
|
||||
* File not found exception
|
||||
*
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
public class FileNotFoundException extends RIOException {
|
||||
public FileNotFoundException() {
|
||||
super("File not found!");
|
||||
}
|
||||
|
||||
public FileNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public FileNotFoundException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
29
src/main/java/com/cubetiqs/exception/RException.java
Normal file
29
src/main/java/com/cubetiqs/exception/RException.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.cubetiqs.exception;
|
||||
|
||||
/**
|
||||
* Runtime Exception
|
||||
*
|
||||
* @author sombochea
|
||||
* @see RuntimeException
|
||||
* @since 1.0
|
||||
*/
|
||||
public class RException extends RuntimeException {
|
||||
public RException() {
|
||||
}
|
||||
|
||||
public RException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public RException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public RException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public RException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
26
src/main/java/com/cubetiqs/exception/RIOException.java
Normal file
26
src/main/java/com/cubetiqs/exception/RIOException.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.cubetiqs.exception;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* IO Exception
|
||||
*
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
public class RIOException extends IOException {
|
||||
public RIOException() {
|
||||
}
|
||||
|
||||
public RIOException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public RIOException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public RIOException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
24
src/main/java/com/cubetiqs/exception/RNullException.java
Normal file
24
src/main/java/com/cubetiqs/exception/RNullException.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.cubetiqs.exception;
|
||||
|
||||
/**
|
||||
* Null Exception
|
||||
*
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
public class RNullException extends RException {
|
||||
public RNullException() {
|
||||
}
|
||||
|
||||
public RNullException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public RNullException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public RNullException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.cubetiqs.exception.json;
|
||||
|
||||
public class RJsonParseException {
|
||||
}
|
||||
14
src/main/java/com/cubetiqs/lang/NonNull.java
Normal file
14
src/main/java/com/cubetiqs/lang/NonNull.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.cubetiqs.lang;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface NonNull {
|
||||
}
|
||||
14
src/main/java/com/cubetiqs/lang/Nullable.java
Normal file
14
src/main/java/com/cubetiqs/lang/Nullable.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.cubetiqs.lang;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author sombochea
|
||||
* @since 1.0
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface Nullable {
|
||||
}
|
||||
12
src/test/java/com/cubetiqs/test/AssertionTests.java
Normal file
12
src/test/java/com/cubetiqs/test/AssertionTests.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.cubetiqs.test;
|
||||
|
||||
import com.cubetiqs.assertion.Tests;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AssertionTests {
|
||||
@Test
|
||||
public void equalsTests() {
|
||||
Tests.isEquals("1", "1", "values are not equals");
|
||||
Tests.isNotEquals("1", "2", "values are equals");
|
||||
}
|
||||
}
|
||||
11
src/test/java/com/cubetiqs/test/MainTests.java
Normal file
11
src/test/java/com/cubetiqs/test/MainTests.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.cubetiqs.test;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MainTests {
|
||||
@Test
|
||||
public void test() {
|
||||
Assert.assertTrue("this is true", true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user