Group testing modules (#3014)

* move security content from spring-security-rest-full

* swagger update

* move query language to new module

* rename spring-security-rest-full to spring-rest-full

* group persistence modules

* group testing modules

* try fix conflict
This commit is contained in:
Grzegorz Piwowarek
2017-11-12 11:16:46 +01:00
committed by GitHub
parent b383d83bf4
commit 776a01429e
236 changed files with 37 additions and 18 deletions
@@ -0,0 +1,7 @@
package com.baeldung.cucumber;
public class Calculator {
public int add(int a, int b) {
return a + b;
}
}
@@ -0,0 +1,7 @@
package com.baeldung.introductionjukito;
public interface Calculator {
public double add(double a, double b);
}
@@ -0,0 +1,5 @@
package com.baeldung.introductionjukito;
public class ScientificCalculator extends SimpleCalculator {
}
@@ -0,0 +1,10 @@
package com.baeldung.introductionjukito;
public class SimpleCalculator implements Calculator {
@Override
public double add(double a, double b) {
return a+b;
}
}
@@ -0,0 +1,11 @@
package com.baeldung.junit;
public class Calculator {
public int add(int a, int b) {
return a + b;
}
public int sub(int a, int b) {
return a - b;
}
}
@@ -0,0 +1,15 @@
package com.baeldung.junitparams;
public class SafeAdditionUtil {
public int safeAdd(int a, int b) {
long result = ((long) a) + b;
if (result > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
} else if (result < Integer.MIN_VALUE) {
return Integer.MIN_VALUE;
}
return (int) result;
}
}
@@ -0,0 +1,24 @@
package com.baeldung.lambdabehave;
public class Calculator {
private int x;
private int y;
Calculator(int x, int y) {
this.x = x;
this.y = y;
}
public int add() {
return this.x + this.y;
}
public int divide(int a, int b) {
return a / b;
}
public int add(int a, int b) {
return a + b;
}
}
@@ -0,0 +1,19 @@
package com.baeldung.testing.assertj;
public class Dog {
private String name;
private Float weight;
public Dog(String name, Float weight) {
this.name = name;
this.weight = weight;
}
public String getName() {
return name;
}
public Float getWeight() {
return weight;
}
}
@@ -0,0 +1,19 @@
package com.baeldung.testing.assertj;
public class Person {
private String name;
private Integer age;
public Person(String name, Integer age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public Integer getAge() {
return age;
}
}
@@ -0,0 +1,15 @@
package com.baeldung.testing.mutation;
public class Palindrome {
public boolean isPalindrome(String inputString) {
if (inputString.length() == 0) {
return true;
} else {
char firstChar = inputString.charAt(0);
char lastChar = inputString.charAt(inputString.length() - 1);
String mid = inputString.substring(1, inputString.length() - 1);
return (firstChar == lastChar) && isPalindrome(mid);
}
}
}
@@ -0,0 +1,57 @@
package com.baeldung.testing.truth;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class User implements Comparable<User> {
private String name = "John Doe";
private List<String> emails = Arrays.asList("contact@baeldung.com", "staff@baeldung.com");
public User() {
}
public User(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<String> getEmails() {
return emails;
}
public void setEmails(List<String> emails) {
this.emails = emails;
}
@Override
public int hashCode() {
int hash = 5;
hash = 37 * hash + Objects.hashCode(this.name);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final User other = (User) obj;
return Objects.equals(this.name, other.name);
}
@Override
public int compareTo(User o) {
return this.getName()
.compareToIgnoreCase(o.getName());
}
}
@@ -0,0 +1,46 @@
package com.baeldung.testing.truth;
import com.google.common.truth.ComparableSubject;
import com.google.common.truth.FailureStrategy;
import com.google.common.truth.IterableSubject;
import com.google.common.truth.SubjectFactory;
import com.google.common.truth.Truth;
public class UserSubject extends ComparableSubject<UserSubject, User> {
private UserSubject(FailureStrategy failureStrategy, User target) {
super(failureStrategy, target);
}
private static final SubjectFactory<UserSubject, User> USER_SUBJECT_FACTORY = new SubjectFactory<UserSubject, User>() {
@Override
public UserSubject getSubject(FailureStrategy failureStrategy, User target) {
return new UserSubject(failureStrategy, target);
}
};
public static UserSubject assertThat(User user) {
return Truth.assertAbout(USER_SUBJECT_FACTORY)
.that(user);
}
// Our API begins here
public void hasName(String name) {
if (!actual().getName()
.equals(name)) {
fail("has name", name);
}
}
public void hasNameIgnoringCase(String name) {
if (!actual().getName()
.equalsIgnoreCase(name)) {
fail("has name ignoring case", name);
}
}
public IterableSubject emails() {
return Truth.assertThat(actual().getEmails());
}
}