// Path: Source/test/jReto/util/TestData.java
// public class TestData {
// 	public static ByteBuffer generate(int length) {
// 		ByteBuffer buffer = ByteBuffer.allocate(length);
// 		for (int i=0; i<length; i++) {
// 			buffer.put((byte)(i%127));
// 		}
// 		buffer.rewind();
// 		return buffer;
// 	}
// 	
// 	public static void verify(ByteBuffer buffer, int length) {
// 		int count = buffer.remaining();
// 		if (count != length) throw new IllegalArgumentException("Test data needs to have the correct length");
// 		
// 		for (int i=0; i<count; i++) {
// 			byte value = buffer.get();
// 			
// 			if (value != i%127) throw new IllegalArgumentException("Buffer has incorrect value: "+value+", should be: "+i%127);
// 		}
// 	}
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/connectivity/DefaultDataConsumer.java
// public class DefaultDataConsumer {
// 	private final ByteBuffer data;
// 	private final int length;
// 	
// 	public DefaultDataConsumer(int length) {
// 		this.length = length;
// 		this.data = ByteBuffer.allocate(length);
// 	}
// 	
// 	public int getDataLength() {
// 		return this.length;
// 	}
// 
// 	public void consume(ByteBuffer data) {
// 		if (this.data.remaining() < data.remaining()) throw new IllegalArgumentException("data contains "+data.remaining()+" additional bytes, can consume "+this.data.remaining()+" bytes maximum.");
// 		this.data.put(data);
// 	}
// 	
// 	public ByteBuffer getData() {
// 		this.data.rewind();
// 		return this.data;
// 	}
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/connectivity/DefaultDataSource.java
// public class DefaultDataSource {
// 	private final int length;
// 	private final ByteBuffer data;
// 	
// 	public DefaultDataSource(ByteBuffer data) {
// 		this.length = data.remaining();
// 		this.data = data;
// 	}
// 	
// 	public int getDataLength() {
// 		return this.length;
// 	}
// 
// 	public ByteBuffer getData(int offset, int length) {		
// 		if (offset+length > this.length) {
// 			throw new IllegalArgumentException("Trying to use offset "+offset+" and length "+length+", total buffer length is "+this.length);
// 		}
// 		// Note: this implementation should be reasonably fast. No data is copied; this creates just a new "view" on the buffer
// 		ByteBuffer result = this.data.duplicate();
// 		
// 		result.position(offset);
// 		result = result.slice();
// 		result.limit(length);
// 	
// 		result.rewind();
// 
// 		return result;
// 	}
// }


import jReto.util.TestData;
import org.junit.Test;
import de.tum.in.www1.jReto.connectivity.DefaultDataConsumer;
import de.tum.in.www1.jReto.connectivity.DefaultDataSource;
package jReto.unit;




/**
 * Tests for DefaultDataConsumer and DefaultDataSource.
 * */
public class DefaultDataProcessingTest {

	
	@Test (expected = IllegalArgumentException.class)
	public void invalidSourceTest1() {
// Path: Source/test/jReto/util/TestData.java
// public class TestData {
// 	public static ByteBuffer generate(int length) {
// 		ByteBuffer buffer = ByteBuffer.allocate(length);
// 		for (int i=0; i<length; i++) {
// 			buffer.put((byte)(i%127));
// 		}
// 		buffer.rewind();
// 		return buffer;
// 	}
// 	
// 	public static void verify(ByteBuffer buffer, int length) {
// 		int count = buffer.remaining();
// 		if (count != length) throw new IllegalArgumentException("Test data needs to have the correct length");
// 		
// 		for (int i=0; i<count; i++) {
// 			byte value = buffer.get();
// 			
// 			if (value != i%127) throw new IllegalArgumentException("Buffer has incorrect value: "+value+", should be: "+i%127);
// 		}
// 	}
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/connectivity/DefaultDataConsumer.java
// public class DefaultDataConsumer {
// 	private final ByteBuffer data;
// 	private final int length;
// 	
// 	public DefaultDataConsumer(int length) {
// 		this.length = length;
// 		this.data = ByteBuffer.allocate(length);
// 	}
// 	
// 	public int getDataLength() {
// 		return this.length;
// 	}
// 
// 	public void consume(ByteBuffer data) {
// 		if (this.data.remaining() < data.remaining()) throw new IllegalArgumentException("data contains "+data.remaining()+" additional bytes, can consume "+this.data.remaining()+" bytes maximum.");
// 		this.data.put(data);
// 	}
// 	
// 	public ByteBuffer getData() {
// 		this.data.rewind();
// 		return this.data;
// 	}
// }
// 
// Path: Source/src/de/tum/in/www1/jReto/connectivity/DefaultDataSource.java
// public class DefaultDataSource {
// 	private final int length;
// 	private final ByteBuffer data;
// 	
// 	public DefaultDataSource(ByteBuffer data) {
// 		this.length = data.remaining();
// 		this.data = data;
// 	}
// 	
// 	public int getDataLength() {
// 		return this.length;
// 	}
// 
// 	public ByteBuffer getData(int offset, int length) {		
// 		if (offset+length > this.length) {
// 			throw new IllegalArgumentException("Trying to use offset "+offset+" and length "+length+", total buffer length is "+this.length);
// 		}
// 		// Note: this implementation should be reasonably fast. No data is copied; this creates just a new "view" on the buffer
// 		ByteBuffer result = this.data.duplicate();
// 		
// 		result.position(offset);
// 		result = result.slice();
// 		result.limit(length);
// 	
// 		result.rewind();
// 
// 		return result;
// 	}
// }


// Path: Source/test/jReto/unit/DefaultDataProcessingTest.java
import jReto.util.TestData;
import org.junit.Test;
import de.tum.in.www1.jReto.connectivity.DefaultDataConsumer;
import de.tum.in.www1.jReto.connectivity.DefaultDataSource;

package jReto.unit;




/**
 * Tests for DefaultDataConsumer and DefaultDataSource.
 * */
public class DefaultDataProcessingTest {

	
	@Test (expected = IllegalArgumentException.class)
	public void invalidSourceTest1() {
		DefaultDataSource source = new DefaultDataSource(TestData.generate(0));