-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
76 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
dd-java-agent/agent-debugger/src/test/java/com/datadog/debugger/probe/SamplingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.datadog.debugger.probe; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class SamplingTest { | ||
@Test | ||
public void sampling() { | ||
Sampling sampling = new Sampling(); | ||
|
||
assertEquals(0, sampling.getEventsPerSecond()); | ||
assertEquals(0, sampling.getCoolDownInSeconds()); | ||
assertFalse(sampling.inCoolDown()); | ||
} | ||
|
||
@Test | ||
public void inCoolDown() { | ||
Sampling sampling = new Sampling(5); | ||
|
||
assertEquals(0, sampling.getEventsPerSecond()); | ||
assertEquals(5, sampling.getCoolDownInSeconds()); | ||
assertFalse(sampling.inCoolDown()); | ||
assertTrue(sampling.inCoolDown()); | ||
} | ||
|
||
@Test | ||
public void constructors() { | ||
assertEquals(new Sampling(0, 0.0), new Sampling()); | ||
assertEquals(new Sampling(0, 42.0), new Sampling(42.0)); | ||
assertEquals(new Sampling(10, 0.0), new Sampling(10)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters