forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99439e7
commit f20f1fc
Showing
5 changed files
with
90 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 31 additions & 31 deletions
62
src/bindings/jna/libelektra5j/src/test/java/org/libelektra/KeyNameIteratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
package org.libelektra; | ||
|
||
import org.junit.Test; | ||
import static org.junit.Assert.*; | ||
|
||
import java.util.Iterator; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class KeyNameIteratorTest { | ||
public class KeyNameIteratorTest | ||
{ | ||
|
||
static final String KEY_1_NAME = "/key_test/1/key_name"; | ||
static final String KEY_1_NAME_PART_1 = "\u0001"; | ||
static final String KEY_1_NAME_PART_2 = "key_test"; | ||
static final String KEY_1_NAME_PART_3 = "1"; | ||
static final String KEY_1_NAME_PART_4 = "key_name"; | ||
static final String KEY_1_VALUE = "key_value_1"; | ||
static final String KEY_1_NAME = "/key_test/1/key_name"; | ||
static final String KEY_1_NAME_PART_1 = "\u0001"; | ||
static final String KEY_1_NAME_PART_2 = "key_test"; | ||
static final String KEY_1_NAME_PART_3 = "1"; | ||
static final String KEY_1_NAME_PART_4 = "key_name"; | ||
static final String KEY_1_VALUE = "key_value_1"; | ||
|
||
@Test | ||
public void test_keyNameIteratorHasNext_shouldPass() { | ||
final Key key = Key.create (KEY_1_NAME, KEY_1_VALUE); | ||
final Iterator<String> iterator = key.iterator (); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_1, iterator.next ()); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_2, iterator.next ()); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_3, iterator.next ()); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_4, iterator.next ()); | ||
assertFalse (iterator.hasNext ()); | ||
} | ||
@Test public void test_keyNameIteratorHasNext_shouldPass () | ||
{ | ||
final Key key = Key.create (KEY_1_NAME, KEY_1_VALUE); | ||
final Iterator<String> iterator = key.iterator (); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_1, iterator.next ()); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_2, iterator.next ()); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_3, iterator.next ()); | ||
assertTrue (iterator.hasNext ()); | ||
assertEquals (KEY_1_NAME_PART_4, iterator.next ()); | ||
assertFalse (iterator.hasNext ()); | ||
} | ||
|
||
@Test(expected = UnsupportedOperationException.class) | ||
public void test_keyNameIteratorDelete_shouldPass() { | ||
final Key key = Key.create (KEY_1_NAME, KEY_1_VALUE); | ||
final Iterator<String> iterator = key.iterator (); | ||
assertTrue (iterator.hasNext ()); | ||
iterator.remove (); | ||
} | ||
@Test (expected = UnsupportedOperationException.class) public void test_keyNameIteratorDelete_shouldPass () | ||
{ | ||
final Key key = Key.create (KEY_1_NAME, KEY_1_VALUE); | ||
final Iterator<String> iterator = key.iterator (); | ||
assertTrue (iterator.hasNext ()); | ||
iterator.remove (); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 55 additions & 53 deletions
108
src/bindings/jna/libelektra5j/src/test/java/org/libelektra/plugin/ReturnTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,63 @@ | ||
package org.libelektra.plugin; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.libelektra.Key; | ||
import org.libelektra.KeySet; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class ReturnTest { | ||
|
||
static final String ERROR_KEY_NAME = "/temporary/errorkey"; | ||
static final String ERROR_KEY_VALUE = "error"; | ||
|
||
private Return returnPlugin; | ||
private Key errorKey; | ||
|
||
@Before public void setup() { | ||
returnPlugin = new Return(); | ||
errorKey = Key.create(ERROR_KEY_NAME, ERROR_KEY_VALUE); | ||
} | ||
|
||
@Test | ||
public void test_returnOpen_shouldBeCode0(){ | ||
KeySet config = returnPlugin.getConfig(); | ||
int open = returnPlugin.open(config, errorKey); | ||
assertEquals(0, open); | ||
} | ||
|
||
@Test | ||
public void test_returnGet_ShouldBeCode10() { | ||
KeySet config = returnPlugin.getConfig(); | ||
int open = returnPlugin.get(config, errorKey); | ||
assertEquals(10, open); | ||
} | ||
|
||
@Test | ||
public void test_returnSet_ShouldBeCode20() { | ||
KeySet config = returnPlugin.getConfig(); | ||
int open = returnPlugin.set(config, errorKey); | ||
assertEquals(20, open); | ||
} | ||
|
||
@Test | ||
public void test_returnError_ShouldBeCode30() { | ||
KeySet config = returnPlugin.getConfig(); | ||
int open = returnPlugin.error(config, errorKey); | ||
assertEquals(30, open); | ||
} | ||
|
||
@Test | ||
public void test_returnClose_ShouldBeCode0() { | ||
int open = returnPlugin.close(errorKey); | ||
assertEquals(0, open); | ||
} | ||
|
||
@Test | ||
public void test_returnGetName_ShouldBeReturn() { | ||
assertEquals(Return.PLUGIN_NAME, returnPlugin.getName()); | ||
} | ||
public class ReturnTest | ||
{ | ||
|
||
static final String ERROR_KEY_NAME = "/temporary/errorkey"; | ||
static final String ERROR_KEY_VALUE = "error"; | ||
|
||
private Return returnPlugin; | ||
private Key errorKey; | ||
|
||
@Before public void setup () | ||
{ | ||
returnPlugin = new Return (); | ||
errorKey = Key.create (ERROR_KEY_NAME, ERROR_KEY_VALUE); | ||
} | ||
|
||
@Test public void test_returnOpen_shouldBeCode0 () | ||
{ | ||
KeySet config = returnPlugin.getConfig (); | ||
int open = returnPlugin.open (config, errorKey); | ||
assertEquals (0, open); | ||
} | ||
|
||
@Test public void test_returnGet_ShouldBeCode10 () | ||
{ | ||
KeySet config = returnPlugin.getConfig (); | ||
int open = returnPlugin.get (config, errorKey); | ||
assertEquals (10, open); | ||
} | ||
|
||
@Test public void test_returnSet_ShouldBeCode20 () | ||
{ | ||
KeySet config = returnPlugin.getConfig (); | ||
int open = returnPlugin.set (config, errorKey); | ||
assertEquals (20, open); | ||
} | ||
|
||
@Test public void test_returnError_ShouldBeCode30 () | ||
{ | ||
KeySet config = returnPlugin.getConfig (); | ||
int open = returnPlugin.error (config, errorKey); | ||
assertEquals (30, open); | ||
} | ||
|
||
@Test public void test_returnClose_ShouldBeCode0 () | ||
{ | ||
int open = returnPlugin.close (errorKey); | ||
assertEquals (0, open); | ||
} | ||
|
||
@Test public void test_returnGetName_ShouldBeReturn () | ||
{ | ||
assertEquals (Return.PLUGIN_NAME, returnPlugin.getName ()); | ||
} | ||
} |