BAEL-1861 - Running JUnit tests from a Java application (#4526)
* BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * Updates Thymeleaf version to 3.0.9.RELEASE * Added msf4j projects * updated msf4j project folder * fixed issue with spring-thymeleaf/pom.xml * Removed depedency-reduced-pom.xml * Whitespacing fix * Strange git issue with README.MD, wouldn't revert the file * Added jupiter api * Corrected junit test * Added test engine to plugin * Removed extra tag * Little fixes to junit4 and junit4 run from java * Removed scope from pom.xml * Removed bin file from testing * Slight changes for PMD * Slight changes for PMD * ok, moved code to another folder * Renamed and fixed runjunitfromjava * moved test classes to test folder * moved main to src/java * BAEL-1861 Moved test running classes to src/test/java * Added changes to runjunitfromjava * Added changes to runjunitfromjava * BAEL-1861 Changed test execution code examples * BAEL-1861 Changed test execution code examples; formatting
This commit is contained in:
committed by
Predrag Maric
parent
a8288f98a7
commit
c765acd1da
+41
@@ -0,0 +1,41 @@
|
||||
package com.baeldung.junit.runfromjava.listnode;
|
||||
|
||||
public class ListNode {
|
||||
private int value;
|
||||
private ListNode next;
|
||||
|
||||
public ListNode(int v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
public ListNode(int v, ListNode next) {
|
||||
value = v;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public ListNode getNext() {
|
||||
return next;
|
||||
}
|
||||
|
||||
public void setNext(ListNode next) {
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String result = "";
|
||||
ListNode tmp = this;
|
||||
|
||||
while (tmp.next != null) {
|
||||
result += tmp.value + "->";
|
||||
tmp = tmp.next;
|
||||
}
|
||||
|
||||
result += tmp.value;
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.junit.runfromjava.listnode;
|
||||
|
||||
public class MergeLists {
|
||||
|
||||
public ListNode merge(ListNode list1, ListNode list2) {
|
||||
|
||||
if (list1 == null) {
|
||||
return list2;
|
||||
}
|
||||
if (list2 == null) {
|
||||
return list1;
|
||||
}
|
||||
|
||||
if (list1.getValue() <= list2.getValue()) {
|
||||
list1.setNext(merge(list1.getNext(), list2));
|
||||
return list1;
|
||||
} else {
|
||||
list2.setNext(merge(list2.getNext(), list1));
|
||||
return list2;
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.baeldung.junit.runfromjava.listnode;
|
||||
|
||||
public class RemovedNthElement {
|
||||
public ListNode removeNthFromEnd(ListNode head, int n) {
|
||||
|
||||
ListNode start = new ListNode(0);
|
||||
start.setNext(head);
|
||||
|
||||
ListNode fast = start;
|
||||
ListNode slow = start;
|
||||
|
||||
for (int i = 0; i < n + 1 && fast != null; i++) {
|
||||
fast = fast.getNext();
|
||||
}
|
||||
|
||||
while (fast != null) {
|
||||
fast = fast.getNext();
|
||||
slow = slow.getNext();
|
||||
}
|
||||
|
||||
slow.setNext(slow.getNext()
|
||||
.getNext());
|
||||
|
||||
return start.getNext();
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.baeldung.junit.runfromjava.listnode;
|
||||
|
||||
public class RotateList {
|
||||
public ListNode rotateRight(ListNode list, int n) {
|
||||
|
||||
if (list == null || list.getNext() == null) {
|
||||
return list;
|
||||
}
|
||||
|
||||
ListNode tmpList = new ListNode(0);
|
||||
tmpList.setNext(list);
|
||||
ListNode fast = tmpList;
|
||||
ListNode slow = tmpList;
|
||||
|
||||
int listLength;
|
||||
for (listLength = 0; fast.getNext() != null; listLength++) {
|
||||
fast = fast.getNext();
|
||||
}
|
||||
|
||||
for (int j = listLength - n % listLength; j > 0; j--) {
|
||||
slow = slow.getNext();
|
||||
}
|
||||
|
||||
fast.setNext(tmpList.getNext());
|
||||
tmpList.setNext(slow.getNext());
|
||||
slow.setNext(null);
|
||||
|
||||
return tmpList.getNext();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.baeldung.junit.runfromjava.listnode;
|
||||
|
||||
public class SwapNodes {
|
||||
public ListNode swapPairs(ListNode listHead) {
|
||||
|
||||
ListNode result = new ListNode(0);
|
||||
result.setNext(listHead);
|
||||
|
||||
ListNode current = result;
|
||||
|
||||
while (current.getNext() != null && current
|
||||
.getNext()
|
||||
.getNext() != null) {
|
||||
|
||||
ListNode first = current.getNext();
|
||||
ListNode second = current
|
||||
.getNext()
|
||||
.getNext();
|
||||
|
||||
first.setNext(second.getNext());
|
||||
current.setNext(second);
|
||||
current
|
||||
.getNext()
|
||||
.setNext(first);
|
||||
|
||||
current = current
|
||||
.getNext()
|
||||
.getNext();
|
||||
}
|
||||
|
||||
return result.getNext();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user