项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load resolved projects")
void persistResolvedProject() {
ResolvedProject project = new ResolvedProject(
ProjectCoordinates.from("project","artifact"),of(
ArtifactCoordinates.from("project","artifact","v1"),ArtifactCoordinates.from("project","v2"))
);
String artifactAsYaml = persister.writeResolvedProject(project);
ResolvedProject loadedProject = persister.readResolvedProject(artifactAsYaml);
assertthat(loadedProject).isEqualTo(project);
// equality is based on coordinates so we have to check versions explicitly
assertthat(loadedProject.versions()).isEqualTo(project.versions());
}
项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load resolved artifacts")
void persistResolvedArtifact() {
ResolvedArtifact artifact = new ResolvedArtifact(
ArtifactCoordinates.from("artifact.group","version"),of(
ArtifactCoordinates.from("dependee1.group","dep",ArtifactCoordinates.from("dependee2.group","dependee","v2"))
);
String artifactAsYaml = persister.writeResolvedArtifact(artifact);
ResolvedArtifact loadedArtifact = persister.readResolvedArtifact(artifactAsYaml);
assertthat(loadedArtifact).isEqualTo(artifact);
// equality is based on coordinates so we have to check dependees explicitly
assertthat(loadedArtifact.dependees()).isEqualTo(artifact.dependees());
}
项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load analyzed artifacts")
void persistAnalyzedArtifact() {
AnalyzedArtifact artifact = new AnalyzedArtifact(
ArtifactCoordinates.from("artifact.group",of(
Violation.buildFor(
Type.of("artifact.package","Class"),of(
InternalType.of("sun.misc","Unsafe","internal","JDK-internal"),InternalType.of("sun.misc","BASE64Encoder","JDK-internal"))),Violation.buildFor(
Type.of("artifact.package","JDK-internal"))))
);
String artifactAsYaml = persister.writeAnalyzedArtifact(artifact);
AnalyzedArtifact loadedArtifact = persister.readAnalyzedArtifact(artifactAsYaml);
assertthat(loadedArtifact).isEqualTo(artifact);
// equality is based on coordinates so we have to check violations explicitly
assertthat(loadedArtifact.violations()).isEqualTo(artifact.violations());
}
项目:spring-cloud-services-connector
文件:configserverServiceInfoCreatorTest.java
@Test
@displayName("Given a valid kubernetes service we provide a valid config service info")
public void testCreateServiceInfo() throws Exception {
Service service = new Service();
service.setMetadata(getobjectMeta());
service.setSpec(getServiceSpec());
configserverServiceInfo serviceInfo = configserverServiceInfoCreator.createServiceInfo(service);
assertNotNull(serviceInfo);
assertEquals("http://config-service:8080/",serviceInfo.getUri());
}
项目:spring-cloud-services-connector
文件:configserverServiceInfoCreatorTest.java
@Test
@displayName("Given a kubernetes service without ports we launch a NPE")
public void testCreateServiceInfo_Servicenoports() throws Exception {
Service service = new Service();
service.setMetadata(getobjectMeta());
expectThrows(NullPointerException.class,() -> configserverServiceInfoCreator.createServiceInfo(service));
}
项目:spring-cloud-services-connector
文件:configserverServiceInfoCreatorTest.java
@Test
@displayName("Given a kubernetes service without Metadata we launch a NPE")
public void testCreateServiceInfo_ServiceNoMetadata() throws Exception {
Service service = new Service();
service.setSpec(getServiceSpec());
expectThrows(NullPointerException.class,() -> configserverServiceInfoCreator.createServiceInfo(service));
}
项目:spring-cloud-services-connector
文件:configserverServiceInfoCreatorTest.java
@Test
@displayName("Given the service file,when we instantiate the content then we get a KubernetesServiceInfoCreator")
public void testKubernetesServiceInfoCreatorFromServiceFile() throws Exception {
InputStream resourceAsstream = this.getClass().getResourceAsstream(
"/meta-inf/services/org.springframework.cloud.kubernetes.connector.KubernetesServiceInfoCreator");
byte[] bytes = new byte[resourceAsstream.available()];
resourceAsstream.read(bytes);
Class<?> aClass = Class.forName(new String(bytes));
Object o = aClass.newInstance();
assertTrue(o instanceof KubernetesServiceInfoCreator);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("with null channel,throws NPE")
void decoratedChannelNull_throwsException() {
assertthatThrownBy(
() -> new ReplayingTaskChannelDecorator<>(null,emptySet(),emptySet()))
.isinstanceOf(NullPointerException.class)
.hasMessageContaining("decoratedChannel");
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("with null task replay collection,throws NPE")
void tasksToReplayNull_throwsException() {
assertthatThrownBy(
() -> new ReplayingTaskChannelDecorator<>(decoratedChannel,null,emptySet()))
.isinstanceOf(NullPointerException.class)
.hasMessageContaining("tasksToReplay");
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("with null result replay collection,throws NPE")
void resultsToReplayNull_throwsException() {
assertthatThrownBy(
() -> new ReplayingTaskChannelDecorator<>(decoratedChannel,emptySet()))
.isinstanceOf(NullPointerException.class)
.hasMessageContaining("resultsToReplay");
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("with null error replay collection,throws NPE")
void errorsToReplayNull_throwsException() {
assertthatThrownBy(
() -> new ReplayingTaskChannelDecorator<>(decoratedChannel,null))
.isinstanceOf(NullPointerException.class)
.hasMessageContaining("errorsToReplay");
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("returns only results from decorated channel")
void drainResults_onlyFromDecoratedChannel() {
List<Integer> decoratedResults = asList(1,2,3);
when(decoratedChannel.drainResults()).thenReturn(decoratedResults.stream());
assertthat(replayingChannel.drainResults()).containsExactlyElementsOf(decoratedResults);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("returns only errors from decorated channel")
void drainErrors_onlyFromDecoratedChannel() {
List<Exception> decoratedErrors = asList(
new Exception("X"),new Exception("Y")
);
Stream<Exception> errors = decoratedChannel.drainErrors();
when(errors).thenReturn(decoratedErrors.stream());
assertthat(replayingChannel.drainErrors()).containsExactlyElementsOf(decoratedErrors);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("gets tasks from replay,then from decorated channel")
void getTask_tasksGetReplayed() throws InterruptedException {
List<String> decoratedTasks = of("X","Y","Z");
OngoingStubbing<String> stubbingGetTask = when(decoratedChannel.getTask());
for (String task : decoratedTasks)
stubbingGetTask = stubbingGetTask.thenReturn(task);
int taskTotal = tasksToReplay.size() + decoratedTasks.size();
List<String> tasks = takeTimes(replayingChannel::getTask,taskTotal);
assertthat(tasks).containsExactlyElementsOf(concat(tasksToReplay,decoratedTasks));
verify(decoratedChannel,times(decoratedTasks.size())).getTask();
verifyNoMoreInteractions(decoratedChannel);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("gets results from replay,then from decorated channel")
void drainResults_resultsGetReplayed() {
List<Integer> decoratedResults = asList(10,20,30);
when(decoratedChannel.drainResults()).thenReturn(decoratedResults.stream());
Stream<Integer> results = replayingChannel.drainResults();
assertthat(results).containsExactlyElementsOf(concat(resultsToReplay,decoratedResults));
verify(decoratedChannel).drainResults();
verifyNoMoreInteractions(decoratedChannel);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("gets results from replay only once")
void drainResults_resultsGetReplayedOnce() {
List<Integer> decoratedResults_1 = asList(10,30);
List<Integer> decoratedResults_2 = asList(100,200,300);
when(decoratedChannel.drainResults()).thenReturn(decoratedResults_1.stream(),decoratedResults_2.stream());
// the first call should drain the replay and call the stubbed method for the first time
replayingChannel.drainResults().forEach(ignored -> {
});
// the second call should return only the result from the stubbed method
Stream<Integer> results = replayingChannel.drainResults();
assertthat(results).containsExactlyElementsOf(decoratedResults_2);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("gets errors from replay,then from decorated channel")
void drainErrors_errorsGetReplayed() {
List<Exception> decoratedErrors = asList(new Exception("ABC"),new Exception("XYZ"));
when(decoratedChannel.drainErrors()).thenReturn(decoratedErrors.stream());
Stream<Exception> errors = replayingChannel.drainErrors();
assertthat(errors).containsExactlyElementsOf(concat(errorsToReplay,decoratedErrors));
verify(decoratedChannel).drainErrors();
verifyNoMoreInteractions(decoratedChannel);
}
项目:jdeps-wall-of-shame
文件:ReplayingTaskChannelDecoratorTest.java
@Test
@displayName("gets errors from replay only once")
void drainErrors_resultsGetReplayedOnce() {
List<Exception> decoratedErrors_1 = asList(new Exception("A"),new Exception("X"));
List<Exception> decoratedErrors_2 = asList(new Exception("ABC"),new Exception("XYZ"));
when(decoratedChannel.drainErrors()).thenReturn(decoratedErrors_1.stream(),decoratedErrors_2.stream());
// the first call should drain the replay and call the stubbed method for the first time
replayingChannel.drainErrors().forEach(ignored -> {
});
// the second call should return only the result from the stubbed method
Stream<Exception> results = replayingChannel.drainErrors();
assertthat(results).containsExactlyElementsOf(decoratedErrors_2);
}
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
@Test
@displayName("with null decorated channel,throws NPE")
void decoratedChannelNull_throwsException() {
assertthatThrownBy(
() -> new SpyingTaskChannelDecorator<>(null,listeningChannel))
.isinstanceOf(NullPointerException.class)
.hasMessageContaining("decoratedChannel");
}
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
@Test
@displayName("with null listening channel,throws NPE")
void listeningChannelNull_throwsException() {
assertthatThrownBy(
() -> new SpyingTaskChannelDecorator<>(decoratedChannel,null))
.isinstanceOf(NullPointerException.class)
.hasMessageContaining("listeningChannel");
}
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
@Test
@displayName("errors")
void sendError_errorGetsRelayed() throws InterruptedException {
Exception error = new Exception("ABC");
spyingChannel.sendError(error);
verify(decoratedChannel).sendError(error);
verify(listeningChannel).sendError(error);
verifyNoMoreInteractions(decoratedChannel,listeningChannel);
}
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:SpyingTaskChannelDecoratorTest.java
项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load projects")
void persistProject() {
ProjectCoordinates project = ProjectCoordinates.from("org.group","theProject");
String projectAsYaml = persister.writeProject(project);
ProjectCoordinates loadedProject = persister.readProject(projectAsYaml);
assertthat(loadedProject).isEqualTo(project);
}
项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load Failed projects")
void persistFailedProject() {
FailedProject project = new FailedProject(
ProjectCoordinates.from("org.group","theProject"),new Exception("error message")
);
String projectAsYaml = persister.writeFailedProject(project);
FailedProject loadedProject = persister.readFailedProject(projectAsYaml);
assertthat(loadedProject).isEqualTo(project);
}
项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load artifacts")
void persistArtifact() {
ArtifactCoordinates artifact = ArtifactCoordinates.from("org.group","theArtifact","v1.Foo");
String artifactAsYaml = persister.writeArtifact(artifact);
ArtifactCoordinates loadedArtifact = persister.readArtifact(artifactAsYaml);
assertthat(loadedArtifact).isEqualTo(artifact);
}
项目:jdeps-wall-of-shame
文件:YamlPersisterTest.java
@Test
@displayName("can dump and load Failed artifacts")
void persistFailedArtifact() {
FailedArtifact artifact = new FailedArtifact(
ArtifactCoordinates.from("org.group","v1.Foo"),new Exception("error message")
);
String artifactAsYaml = persister.writeFailedArtifact(artifact);
FailedArtifact loadedArtifact = persister.readFailedArtifact(artifactAsYaml);
assertthat(loadedArtifact).isEqualTo(artifact);
}
项目:evilmusic
文件:PlaylistRESTTest.java
@Test
@displayName("removes an element from the playlist")
void removesElement() throws IOException {
p = PlaylistRESTCalls.removeElement(p.getID(),e0.getID());
assertEquals(2,p.size());
assertEquals(e1.getID(),p.getElement(0).getID());
assertEquals(e2.getID(),p.getElement(1).getID());
}
项目:evilmusic
文件:LibraryUtilsTest.java
@Test
@displayName("will correctly convert a music directory string containing the $home keyword to a file")
void homeKeyword() throws URISyntaxException {
final String home = System.getProperty("user.home");
final String sep = File.separator;
assertNull(LibraryUtils.convertToFile(""));
assertNull(LibraryUtils.convertToFile(null));
assertEquals(home + sep + "docs",LibraryUtils.convertToFile("$home" + sep + "docs").getPath());
assertEquals("foo" + sep + "bar",LibraryUtils.convertToFile("foo" + sep + "bar").getPath());
}
项目:evilmusic
文件:LibraryUtilsTest.java
@Test
@displayName("will correctly convert a music directory string containing a $timestamp keyword to a file")
void timestampKeyword() throws ParseException,URISyntaxException {
final String sep = File.separator;
final String prefix = sep + "foo" + sep;
final String suffix = "bar";
final File f = LibraryUtils.convertToFile(prefix + "$timestamp" + suffix);
final String path = f.getPath();
assertthat(path,new ContainsRecentTimestamp(prefix.length(),path.length() - suffix.length()));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。