File: BndContainerTest.java

package info (click to toggle)
bnd 5.0.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,128 kB
  • sloc: java: 249,039; xml: 90,728; sh: 655; perl: 153; makefile: 96; python: 47; javascript: 9
file content (30 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.bndtools.builder.classpath;

import static org.assertj.core.api.Assertions.assertThat;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import org.junit.Test;

public class BndContainerTest {

	@Test
	public void testBndContainerSerialization() throws Exception {
		ClasspathContainerSerializationHelper<BndContainer> serializationHelper = new ClasspathContainerSerializationHelper<>();

		BndContainer c = new BndContainer.Builder().updateLastModified(System.currentTimeMillis())
			.build();
		assertThat(c).isNotNull();

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		serializationHelper.writeClasspathContainer(c, baos);

		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
		BndContainer c2 = serializationHelper.readClasspathContainer(bais);

		assertThat(c2).isNotSameAs(c);
		assertThat(c2.getClasspathEntries()).isEqualTo(c.getClasspathEntries());
		assertThat(c2.lastModified()).isEqualTo(c.lastModified());

	}

}