You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2017/07/23 14:15:39 UTC
svn commit: r1802728 -
/jmeter/trunk/test/src/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java
Author: fschumacher
Date: Sun Jul 23 14:15:39 2017
New Revision: 1802728
URL: http://svn.apache.org/viewvc?rev=1802728&view=rev
Log:
Spacepolice
Modified:
jmeter/trunk/test/src/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java
Modified: jmeter/trunk/test/src/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java?rev=1802728&r1=1802727&r2=1802728&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java Sun Jul 23 14:15:39 2017
@@ -31,105 +31,106 @@ import org.junit.Before;
import org.junit.Test;
public class TestUnmodifiableJMeterVariables {
-
- private static final String MY_OBJECT_KEY = "my.objectKey";
- private static final String MY_KEY = "my.key";
- private JMeterVariables vars;
- private UnmodifiableJMeterVariables unmodifiables;
-
- @Before
- public void setUp() {
- vars = new JMeterVariables();
- vars.put(MY_KEY, "something to test for");
- vars.putObject(MY_OBJECT_KEY, new Object());
- unmodifiables = new UnmodifiableJMeterVariables(vars);
- }
-
- @Test
- public void testGetThreadName() {
- assertThat(unmodifiables.getThreadName(), CoreMatchers.is(vars.getThreadName()));
- }
-
- @Test
- public void testGetIteration() {
- assertThat(unmodifiables.getIteration(), CoreMatchers.is(vars.getIteration()));
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testIncIteration() {
- unmodifiables.incIteration();
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testRemove() {
- unmodifiables.remove("some.key");
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testPut() {
- unmodifiables.put("some.key", "anything");
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testPutObject() {
- unmodifiables.putObject("some.key", new Object());
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testPutAllMapOfStringQ() {
- unmodifiables.putAll(Collections.emptyMap());;
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testPutAllJMeterVariables() {
- unmodifiables.putAll(vars);
- }
-
- @Test
- public void testGet() {
- assertThat(unmodifiables.get(MY_KEY), CoreMatchers.is(vars.get(MY_KEY)));
- }
-
- @Test
- public void testGetObject() {
- assertThat(unmodifiables.getObject(MY_OBJECT_KEY), CoreMatchers.is(vars.getObject(MY_OBJECT_KEY)));
- }
-
- @Test(expected=UnsupportedOperationException.class)
- public void testGetIteratorIsUnmodifable() {
- Iterator<Entry<String, Object>> iterator = unmodifiables.getIterator();
- assertThat(iterator.hasNext(), CoreMatchers.is(true));
- iterator.next();
- iterator.remove();
- }
-
- @Test
- public void testGetIterator() {
- assertThat(iteratorToMap(unmodifiables.getIterator()), CoreMatchers.is(iteratorToMap(vars.getIterator())));
- }
-
- private <K,V> Map<K, V>iteratorToMap(Iterator<Entry<K, V>> it) {
- Map<K,V> result = new HashMap<>();
- while (it.hasNext()) {
- Entry<K, V> entry = it.next();
- result.put(entry.getKey(), entry.getValue());
- }
- return result;
- }
-
- @Test
- public void testEntrySet() {
- assertThat(unmodifiables.entrySet(), CoreMatchers.is(vars.entrySet()));
- }
-
- @Test
- public void testEqualsObject() {
- assertThat(unmodifiables, CoreMatchers.is(vars));
- }
-
- @Test
- public void testHashCode() {
- assertThat(unmodifiables.hashCode(), CoreMatchers.is(vars.hashCode()));
- }
+
+ private static final String MY_OBJECT_KEY = "my.objectKey";
+ private static final String MY_KEY = "my.key";
+ private JMeterVariables vars;
+ private UnmodifiableJMeterVariables unmodifiables;
+
+ @Before
+ public void setUp() {
+ vars = new JMeterVariables();
+ vars.put(MY_KEY, "something to test for");
+ vars.putObject(MY_OBJECT_KEY, new Object());
+ unmodifiables = new UnmodifiableJMeterVariables(vars);
+ }
+
+ @Test
+ public void testGetThreadName() {
+ assertThat(unmodifiables.getThreadName(), CoreMatchers.is(vars.getThreadName()));
+ }
+
+ @Test
+ public void testGetIteration() {
+ assertThat(unmodifiables.getIteration(), CoreMatchers.is(vars.getIteration()));
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testIncIteration() {
+ unmodifiables.incIteration();
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testRemove() {
+ unmodifiables.remove("some.key");
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testPut() {
+ unmodifiables.put("some.key", "anything");
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testPutObject() {
+ unmodifiables.putObject("some.key", new Object());
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testPutAllMapOfStringQ() {
+ unmodifiables.putAll(Collections.emptyMap());
+ ;
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testPutAllJMeterVariables() {
+ unmodifiables.putAll(vars);
+ }
+
+ @Test
+ public void testGet() {
+ assertThat(unmodifiables.get(MY_KEY), CoreMatchers.is(vars.get(MY_KEY)));
+ }
+
+ @Test
+ public void testGetObject() {
+ assertThat(unmodifiables.getObject(MY_OBJECT_KEY), CoreMatchers.is(vars.getObject(MY_OBJECT_KEY)));
+ }
+
+ @Test(expected = UnsupportedOperationException.class)
+ public void testGetIteratorIsUnmodifable() {
+ Iterator<Entry<String, Object>> iterator = unmodifiables.getIterator();
+ assertThat(iterator.hasNext(), CoreMatchers.is(true));
+ iterator.next();
+ iterator.remove();
+ }
+
+ @Test
+ public void testGetIterator() {
+ assertThat(iteratorToMap(unmodifiables.getIterator()), CoreMatchers.is(iteratorToMap(vars.getIterator())));
+ }
+
+ private <K, V> Map<K, V> iteratorToMap(Iterator<Entry<K, V>> it) {
+ Map<K, V> result = new HashMap<>();
+ while (it.hasNext()) {
+ Entry<K, V> entry = it.next();
+ result.put(entry.getKey(), entry.getValue());
+ }
+ return result;
+ }
+
+ @Test
+ public void testEntrySet() {
+ assertThat(unmodifiables.entrySet(), CoreMatchers.is(vars.entrySet()));
+ }
+
+ @Test
+ public void testEqualsObject() {
+ assertThat(unmodifiables, CoreMatchers.is(vars));
+ }
+
+ @Test
+ public void testHashCode() {
+ assertThat(unmodifiables.hashCode(), CoreMatchers.is(vars.hashCode()));
+ }
}