List of usage examples for java.util SortedSet contains
boolean contains(Object o);
From source file:co.rsk.peg.BridgeStorageProviderTest.java
@Test public void createSaveAndRecreateInstanceWithProcessedHashes() throws IOException { Sha256Hash hash1 = PegTestUtils.createHash(); Sha256Hash hash2 = PegTestUtils.createHash(); Repository repository = new RepositoryImpl(); Repository track = repository.startTracking(); BridgeStorageProvider provider0 = new BridgeStorageProvider(track, PrecompiledContracts.BRIDGE_ADDR); provider0.getBtcTxHashesAlreadyProcessed().add(hash1); provider0.getBtcTxHashesAlreadyProcessed().add(hash2); provider0.save();// w w w. java 2 s . co m track.commit(); track = repository.startTracking(); BridgeStorageProvider provider = new BridgeStorageProvider(track, PrecompiledContracts.BRIDGE_ADDR); SortedSet<Sha256Hash> processed = provider.getBtcTxHashesAlreadyProcessed(); Assert.assertTrue(processed.contains(hash1)); Assert.assertTrue(processed.contains(hash2)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineSingle() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;[2]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 1, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); }
From source file:relationalFramework.RelationalPolicy.java
/** * Checks if this action is in the valid actions. * /*from w w w. ja va2 s.c o m*/ * @param actionArgs * The action args being checked. * @param validArgs * The set of valid action args. * @return True if the action is valid, false otherwise. */ private boolean isValidAction(String[] actionArgs, SortedSet<String[]> validArgs) { // If there are no chances for this action at all, return false. if (validArgs == null) return false; if (validArgs.contains(actionArgs)) return true; return false; }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineMixed() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;[2,4-6]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 4, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testParseLineRange() throws Exception { final CoveragePattern pattern = CoveragePattern.parseLine("resourcePattern;[2-6]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 5, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 3", full.contains(3)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testAddLine() throws Exception { final SortedSet<Integer> lines = new TreeSet<>(); lines.add(1);/*from www . j av a 2 s . com*/ lines.add(3); lines.add(5); final CoveragePattern pattern = new CoveragePattern("resourcePattern", lines); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 3, full.size()); Assert.assertTrue("SortedSet must contain line 1", full.contains(1)); Assert.assertTrue("SortedSet must contain line 3", full.contains(3)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.CoveragePatternTest.java
@Test public void testAddLines() throws Exception { final SortedSet<Integer> lines = new TreeSet<>(); CoveragePattern.addLines(lines, 2, 2); CoveragePattern.addLines(lines, 4, 6); final CoveragePattern pattern = new CoveragePattern("resourcePattern", lines); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 4, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.IssuePatternTest.java
@Test public void testParseLineSingle() throws Exception { final IssuePattern pattern = IssuePattern.parseLine("resourcePattern;rulePattern;[2]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); Assert.assertEquals("rulePattern name must match", "rulePattern", pattern.getRulePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 1, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.IssuePatternTest.java
@Test public void testParseLineMixed() throws Exception { final IssuePattern pattern = IssuePattern.parseLine("resourcePattern;rulePattern;[2,4-6]"); Assert.assertEquals("resourcePattern name must match", "resourcePattern", pattern.getResourcePattern()); Assert.assertEquals("rulePattern name must match", "rulePattern", pattern.getRulePattern()); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 4, full.size()); Assert.assertTrue("SortedSet must contain line 2", full.contains(2)); Assert.assertTrue("SortedSet must contain line 4", full.contains(4)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); Assert.assertTrue("SortedSet must contain line 6", full.contains(6)); }
From source file:de.shadowhunt.sonar.plugins.ignorecode.model.IssuePatternTest.java
@Test public void testAddLine() throws Exception { final SortedSet<Integer> lines = new TreeSet<>(); lines.add(1);// w w w .j av a 2 s . co m lines.add(3); lines.add(5); final IssuePattern pattern = new IssuePattern("resourcePattern", "rulePattern", lines); final SortedSet<Integer> full = pattern.getLines(); Assert.assertNotNull("SortedSet must not be null", full); Assert.assertEquals("SortedSet must contain the exact number of entries", 3, full.size()); Assert.assertTrue("SortedSet must contain line 1", full.contains(1)); Assert.assertTrue("SortedSet must contain line 3", full.contains(3)); Assert.assertTrue("SortedSet must contain line 5", full.contains(5)); }