Commit 22b02a6c authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.4.x'

Closes gh-25823
parents 9087c247 a025f3d2
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -20,6 +20,7 @@ import java.util.Set; ...@@ -20,6 +20,7 @@ import java.util.Set;
import org.springframework.boot.devtools.filewatch.ChangedFiles; import org.springframework.boot.devtools.filewatch.ChangedFiles;
import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEvent;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
...@@ -64,4 +65,10 @@ public class ClassPathChangedEvent extends ApplicationEvent { ...@@ -64,4 +65,10 @@ public class ClassPathChangedEvent extends ApplicationEvent {
return this.restartRequired; return this.restartRequired;
} }
@Override
public String toString() {
return new ToStringCreator(this).append("changeSet", this.changeSet)
.append("restartRequired", this.restartRequired).toString();
}
} }
/* /*
* Copyright 2012-2020 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -27,6 +27,7 @@ import java.util.Map; ...@@ -27,6 +27,7 @@ import java.util.Map;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.io.TempDir;
import org.springframework.boot.devtools.filewatch.ChangedFile;
import org.springframework.boot.devtools.filewatch.FileSystemWatcher; import org.springframework.boot.devtools.filewatch.FileSystemWatcher;
import org.springframework.boot.devtools.filewatch.FileSystemWatcherFactory; import org.springframework.boot.devtools.filewatch.FileSystemWatcherFactory;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
...@@ -79,9 +80,9 @@ class ClassPathFileSystemWatcherTests { ...@@ -79,9 +80,9 @@ class ClassPathFileSystemWatcherTests {
} }
Thread.sleep(500); Thread.sleep(500);
} }
assertThat(events.size()).isEqualTo(1); assertThat(events).hasSize(1);
assertThat(events.get(0).getChangeSet().iterator().next().getFiles().iterator().next().getFile()) assertThat(events.get(0).getChangeSet().iterator().next()).extracting(ChangedFile::getFile)
.isEqualTo(classFile); .containsExactly(classFile);
context.close(); context.close();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment