org.junit.experimental.categories.Category Java Examples
The following examples show how to use
org.junit.experimental.categories.Category.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: beam Author: apache File: WindowTest.java License: Apache License 2.0 | 6 votes |
@Test @Category({ValidatesRunner.class, UsesCustomWindowMerging.class}) public void testMergingCustomWindowsKeyedCollection() { Instant startInstant = new Instant(0L); PCollection<KV<Integer, String>> inputCollection = pipeline.apply( Create.timestamped( TimestampedValue.of( KV.of(0, "big"), startInstant.plus(Duration.standardSeconds(10))), TimestampedValue.of( KV.of(1, "small1"), startInstant.plus(Duration.standardSeconds(20))), // This element is not contained within the bigWindow and not merged TimestampedValue.of( KV.of(2, "small2"), startInstant.plus(Duration.standardSeconds(39))))); PCollection<KV<Integer, String>> windowedCollection = inputCollection.apply(Window.into(new CustomWindowFn<>())); PCollection<Long> count = windowedCollection.apply( Combine.globally(Count.<KV<Integer, String>>combineFn()).withoutDefaults()); // "small1" and "big" elements merged into bigWindow "small2" not merged // because it is not contained in bigWindow PAssert.that("Wrong number of elements in output collection", count).containsInAnyOrder(2L, 1L); pipeline.run(); }
Example #2
Source Project: mrgeo Author: ngageoint File: MapAlgebraIntegrationTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void expressionIncompletePathInput1() throws Exception { // test expressions with file names mixed in with fullpaths if (GEN_BASELINE_DATA_ONLY) { testUtils.generateBaselineTif(this.conf, testname.getMethodName(), String.format("a = [%s]; b = 3; a / [%s] + b", allones, allonesPath), -9999); } else { testUtils.runRasterExpression(this.conf, testname.getMethodName(), TestUtils.nanTranslatorToMinus9999, TestUtils.nanTranslatorToMinus9999, String.format("a = [%s]; b = 3; a / [%s] + b", allones, allonesPath)); } }
Example #3
Source Project: mrgeo Author: ngageoint File: MissingPyramidsTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void testGetMapTifNonExistingZoomLevelAboveWithoutPyramidsExtraMetadata() throws Exception { String contentType = "image/tiff"; Response response = target("wms") .queryParam("SERVICE", "WMS") .queryParam("REQUEST", "getmap") .queryParam("LAYERS", "IslandsElevation-v2-no-pyramid-extra-metadata") .queryParam("FORMAT", contentType) //pyramid only has a single zoom level = 10; pass in zoom level = 8 .queryParam("BBOX", ISLANDS_ELEVATION_V2_IN_BOUNDS_SINGLE_SOURCE_TILE) .queryParam("WIDTH", MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT) .queryParam("HEIGHT", MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT) .request().get(); processImageResponse(response, contentType, "tif"); }
Example #4
Source Project: box-java-sdk Author: box File: BoxFileTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void renameFileSucceeds() { BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken()); BoxFolder rootFolder = BoxFolder.getRootFolder(api); String originalFileName = "[renameFileSucceeds] Original Name.txt"; String newFileName = "[renameFileSucceeds] New Name.txt"; String fileContent = "Test file"; byte[] fileBytes = fileContent.getBytes(StandardCharsets.UTF_8); InputStream uploadStream = new ByteArrayInputStream(fileBytes); BoxFile.Info uploadedFileInfo = rootFolder.uploadFile(uploadStream, originalFileName); BoxFile uploadedFile = uploadedFileInfo.getResource(); uploadedFile.rename(newFileName); BoxFile.Info newInfo = uploadedFile.getInfo(); assertThat(newInfo.getName(), is(equalTo(newFileName))); uploadedFile.delete(); }
Example #5
Source Project: mrgeo Author: ngageoint File: GetMapTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void testGetMapLowerCaseParams() throws Exception { String contentType = "image/png"; Response response = target("wms") .queryParam("SERVICE", "WMS") .queryParam("request", "getmap") .queryParam("layers", "IslandsElevation-v2") .queryParam("format", contentType) .queryParam("bbox", ISLANDS_ELEVATION_V2_IN_BOUNDS_SINGLE_SOURCE_TILE) .queryParam("width", MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT) .queryParam("height", MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT) .request().get(); processImageResponse(response, contentType, "png"); response.close(); }
Example #6
Source Project: mrgeo Author: ngageoint File: GetMosaicTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void testGetMosaicTifMultipleSourceTiles() throws Exception { String contentType = "image/tiff"; Response response = target("wms") .queryParam("SERVICE", "WMS") .queryParam("REQUEST", "getmosaic") .queryParam("LAYERS", "IslandsElevation-v2") .queryParam("FORMAT", contentType) .queryParam("BBOX", ISLANDS_ELEVATION_V2_IN_BOUNDS_MULTIPLE_SOURCE_TILES) .request().get(); processImageResponse(response, contentType, "tif"); }
Example #7
Source Project: beam Author: apache File: ToStringTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(NeedsRunner.class) public void testToStringKVWithDelimiter() { ArrayList<KV<String, Integer>> kvs = new ArrayList<>(); kvs.add(KV.of("one", 1)); kvs.add(KV.of("two", 2)); ArrayList<String> expected = new ArrayList<>(); expected.add("one\t1"); expected.add("two\t2"); PCollection<KV<String, Integer>> input = p.apply(Create.of(kvs)); PCollection<String> output = input.apply(ToString.kvs("\t")); PAssert.that(output).containsInAnyOrder(expected); p.run(); }
Example #8
Source Project: box-java-sdk Author: box File: BoxFileTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(UnitTest.class) public void testAddClassification() throws IOException { String result = ""; final String fileID = "12345"; final String classificationType = "Public"; final String metadataURL = "/files/" + fileID + "/metadata/enterprise/securityClassification-6VMVochwUWo"; JsonObject metadataObject = new JsonObject() .add("Box__Security__Classification__Key", classificationType); result = TestConfig.getFixture("BoxFile/CreateClassificationOnFile201"); WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(metadataURL)) .withRequestBody(WireMock.equalToJson(metadataObject.toString())) .willReturn(WireMock.aResponse() .withHeader("Content-Type", "application/json") .withBody(result))); BoxFile file = new BoxFile(this.api, fileID); String classification = file.addClassification(classificationType); Assert.assertEquals(classificationType, classification); }
Example #9
Source Project: Open-Realms-of-Stars Author: tuomount File: StarMapUtilitiesTest.java License: GNU General Public License v2.0 | 6 votes |
@Test @Category(org.openRealmOfStars.UnitTest.class) public void testVotingSupportRulerOfGalaxySelf() { PlayerInfo info = Mockito.mock(PlayerInfo.class); Mockito.when(info.getAttitude()).thenReturn(Attitude.AGGRESSIVE); Mockito.when(info.getRace()).thenReturn(SpaceRace.HUMAN); Diplomacy diplomacy = Mockito.mock(Diplomacy.class); Mockito.when(info.getDiplomacy()).thenReturn(diplomacy); Mockito.when(diplomacy.getLiking(0)).thenReturn(Diplomacy.FRIENDS); Mockito.when(diplomacy.getLiking(5)).thenReturn(Diplomacy.HATE); Vote vote = new Vote(VotingType.RULER_OF_GALAXY, 6, 20); vote.setOrganizerIndex(1); vote.setSecondCandidateIndex(5); StarMap map = Mockito.mock(StarMap.class); PlayerList playerList = Mockito.mock(PlayerList.class); Mockito.when(map.getPlayerList()).thenReturn(playerList); Mockito.when(playerList.getIndex(info)).thenReturn(1); Mockito.when(playerList.getCurrentMaxRealms()).thenReturn(6); assertEquals(90, StarMapUtilities.getVotingSupport(info, vote, map)); vote.setOrganizerIndex(0); vote.setSecondCandidateIndex(1); assertEquals(-70, StarMapUtilities.getVotingSupport(info, vote, map)); }
Example #10
Source Project: inception Author: inception-project File: SPARQLQueryBuilderTest.java License: Apache License 2.0 | 6 votes |
@Category(SlowTests.class) @Ignore("#1522 - GND tests not running") @Test public void testWithLabelContainingAnyOf_Fuseki_FTS() throws Exception { assertIsReachable(zbwGnd); kb.setType(REMOTE); kb.setFullTextSearchIri(FTS_FUSEKI); kb.setLabelIri(RDFS.LABEL); kb.setSubPropertyIri(RDFS.SUBPROPERTYOF); List<KBHandle> results = asHandles(zbwGnd, SPARQLQueryBuilder .forItems(kb) .withLabelContainingAnyOf("Schapiro-Frisch", "Stiker-Métral")); assertThat(results).extracting(KBHandle::getIdentifier).doesNotHaveDuplicates(); assertThat(results).isNotEmpty(); assertThat(results).extracting(KBHandle::getUiLabel) .allMatch(label -> label.contains("Schapiro-Frisch") || label.contains("Stiker-Métral")); }
Example #11
Source Project: mrgeo Author: ngageoint File: TileMapServiceResourceIntegrationTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(UnitTest.class) public void testGetTileMapMercator() throws Exception { String version = "1.0.0"; when(request.getRequestURL()) .thenReturn(new StringBuffer("http://localhost:9998/tms/1.0.0/" + rgbsmall_nopyramids_abs + "/global-mercator")); when(service.getMetadata(rgbsmall_nopyramids_abs)) .thenReturn(getMetadata(rgbsmall_nopyramids_abs)); Response response = target("tms" + "/" + version + "/" + URLEncoder.encode(rgbsmall_nopyramids_abs, "UTF-8") + "/global-mercator") .request().get(); Assert.assertEquals(Status.OK.getStatusCode(), response.getStatus()); verify(request, times(1)).getRequestURL(); verify(service, times(1)).getMetadata(rgbsmall_nopyramids_abs); verify(service, times(0)); service.listImages(); verifyNoMoreInteractions(request, service); }
Example #12
Source Project: Open-Realms-of-Stars Author: tuomount File: TutorialListTest.java License: GNU General Public License v2.0 | 6 votes |
@Test @Category(org.openRealmOfStars.UnitTest.class) public void testCorrectOrderSkipIndexes() { TutorialList list = new TutorialList(); HelpLine line = new HelpLine(0); list.add(line); line = new HelpLine(2); list.add(line); line = new HelpLine(4); list.add(line); line = new HelpLine(6); list.add(line); line = new HelpLine(8); list.add(line); assertEquals("0: - \n" + "2: - \n" + "4: - \n" + "6: - \n" + "8: - \n", list.toString()); }
Example #13
Source Project: Open-Realms-of-Stars Author: tuomount File: FleetVisibilityTest.java License: GNU General Public License v2.0 | 6 votes |
@Test @Category(org.openRealmOfStars.UnitTest.class) public void testPrivateer() { Espionage espionage = Mockito.mock(Espionage.class); PlayerInfo info = Mockito.mock(PlayerInfo.class); Mockito.when(info.getEspionage()).thenReturn(espionage); Coordinate coord = Mockito.mock(Coordinate.class); Mockito.when(coord.getX()).thenReturn(10); Mockito.when(coord.getY()).thenReturn(12); Mockito.when(info.getSectorVisibility(coord)).thenReturn(PlayerInfo.VISIBLE); Fleet fleet = Mockito.mock(Fleet.class); Mockito.when(fleet.getCoordinate()).thenReturn(coord); Mockito.when(fleet.isPrivateerFleet()).thenReturn(true); int fleetOwnerIndex = 1; FleetVisibility visiblity = new FleetVisibility(info, fleet, fleetOwnerIndex); assertEquals(true, visiblity.isFleetVisible()); assertEquals(false, visiblity.isEspionageDetected()); assertEquals(false, visiblity.isRecognized()); }
Example #14
Source Project: Open-Realms-of-Stars Author: tuomount File: FleetTest.java License: GNU General Public License v2.0 | 6 votes |
@Test @Category(org.openRealmOfStars.UnitTest.class) public void testFleetWithTradeShip2() { Ship ship = createTradeShip(); Fleet fleet = new Fleet(ship, 2, 3); assertEquals(2, fleet.getCoordinate().getX()); assertEquals(3, fleet.getCoordinate().getY()); fleet.setName("Trader #1"); assertEquals("Trader #1",fleet.getName()); Coordinate tradeCoordinate = new Coordinate(15,16); Mockito.when(ship.calculateTradeCredits((Coordinate) Mockito.any(), (Coordinate) Mockito.any())).thenReturn(4); assertEquals(4, fleet.calculateTrade(tradeCoordinate)); fleet.addShip(ship); assertEquals(8, fleet.calculateTrade(tradeCoordinate)); }
Example #15
Source Project: box-java-sdk Author: box File: BoxGroupTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void getCollaborationsSucceedsAndHandlesResponseCorrectly() { BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken()); String groupName = "[getCollaborationsSucceedsAndHandlesResponseCorrectly] Test Group"; BoxGroup group = BoxGroup.createGroup(api, groupName).getResource(); BoxCollaborator collabGroup = new BoxGroup(api, group.getID()); String folderName = "[getCollaborationsSucceedsAndHandlesResponseCorrectly] Test Folder"; BoxFolder rootFolder = BoxFolder.getRootFolder(api); BoxFolder folder = rootFolder.createFolder(folderName).getResource(); BoxCollaboration.Info collabInfo = folder.collaborate(collabGroup, BoxCollaboration.Role.EDITOR); Collection<BoxCollaboration.Info> collaborations = group.getCollaborations(); assertThat(collaborations, hasSize(1)); assertThat(collaborations, hasItem( Matchers.<BoxCollaboration.Info>hasProperty("ID", equalTo(collabInfo.getID()))) ); group.delete(); folder.delete(false); }
Example #16
Source Project: remote-monitoring-services-java Author: Azure File: AlarmsControllerTest.java License: MIT License | 6 votes |
@Test(timeout = 5000) @Category({UnitTest.class}) public void itUpdateAlarm() throws Exception { AlarmServiceModel alarmResult = new AlarmServiceModel(); IAlarms alarms = mock(IAlarms.class); AlarmsController controller = new AlarmsController(alarms); when(alarms.update( "1", "open")) .thenReturn(alarmResult); setMockContext(); // Act Result response = controller.patch("1"); // Assert assertThat(response.body().isKnownEmpty(), is(false)); }
Example #17
Source Project: beam Author: apache File: BeamEnumerableConverterTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(NeedsRunner.class) public void testToEnumerable_collectNullValue() { Schema schema = Schema.builder().addNullableField("id", fieldType).build(); RelDataType type = CalciteUtils.toCalciteRowType(schema, TYPE_FACTORY); ImmutableList<ImmutableList<RexLiteral>> tuples = ImmutableList.of( ImmutableList.of( rexBuilder.makeNullLiteral(CalciteUtils.toRelDataType(TYPE_FACTORY, fieldType)))); BeamRelNode node = new BeamValuesRel(cluster, type, tuples, null); Enumerable<Object> enumerable = BeamEnumerableConverter.toEnumerable(options, node); Enumerator<Object> enumerator = enumerable.enumerator(); assertTrue(enumerator.moveNext()); Object row = enumerator.current(); assertEquals(null, row); assertFalse(enumerator.moveNext()); enumerator.close(); }
Example #18
Source Project: mrgeo Author: ngageoint File: MapAlgebraIntegrationTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void isNull() throws Exception { // java.util.Properties prop = MrGeoProperties.getInstance(); // prop.setProperty(HadoopUtils.IMAGE_BASE, testUtils.getInputHdfs().toUri().toString()); if (GEN_BASELINE_DATA_ONLY) { testUtils.generateBaselineTif(this.conf, testname.getMethodName(), String.format("isNull([%s])", allones), -9999); } else { testUtils.runRasterExpression(this.conf, testname.getMethodName(), TestUtils.nanTranslatorToMinus9999, TestUtils.nanTranslatorToMinus9999, String.format("isNull([%s])", allones)); } }
Example #19
Source Project: box-java-sdk Author: box File: BoxTrashTest.java License: Apache License 2.0 | 6 votes |
@Test @Category(IntegrationTest.class) public void restoreTrashedFileWithNewNameSucceeds() { BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken()); BoxTrash trash = new BoxTrash(api); BoxFolder rootFolder = BoxFolder.getRootFolder(api); String fileName = "[restoreTrashedFileWithNewNameSucceeds] Trashed File.txt"; String restoredFileName = "[restoreTrashedFileWithNewNameSucceeds] Restored File.txt"; String fileContent = "Trashed file"; byte[] fileBytes = fileContent.getBytes(StandardCharsets.UTF_8); InputStream uploadStream = new ByteArrayInputStream(fileBytes); BoxFile uploadedFile = rootFolder.uploadFile(uploadStream, fileName).getResource(); uploadedFile.delete(); BoxFile.Info restoredFileInfo = trash.restoreFile(uploadedFile.getID(), restoredFileName, null); assertThat(restoredFileInfo.getName(), is(equalTo(restoredFileName))); assertThat(trash, not(hasItem(Matchers.<BoxItem.Info>hasProperty("ID", equalTo(uploadedFile.getID()))))); assertThat(rootFolder, hasItem(Matchers.<BoxItem.Info>hasProperty("ID", equalTo(uploadedFile.getID())))); uploadedFile.delete(); }
Example #20
Source Project: Open-Realms-of-Stars Author: tuomount File: DiplomaticTradeTest.java License: GNU General Public License v2.0 | 6 votes |
@Test @Category(org.openRealmOfStars.UnitTest.class) public void testGetBestFleet2() { StarMap map = generateMapWithPlayer(SpaceRace.SPORKS); PlayerInfo info = Mockito.mock(PlayerInfo.class); ArrayList<Fleet> fleets = new ArrayList<>(); Fleet fleet1 = Mockito.mock(Fleet.class); Mockito.when(fleet1.getMilitaryValue()).thenReturn(10); Mockito.when(fleet1.calculateFleetObsoleteValue(info)).thenReturn(1); fleets.add(fleet1); Fleet fleet2 = Mockito.mock(Fleet.class); Mockito.when(fleet2.getMilitaryValue()).thenReturn(8); Mockito.when(fleet2.calculateFleetObsoleteValue(info)).thenReturn(1); fleets.add(fleet2); Fleet fleet3 = Mockito.mock(Fleet.class); Mockito.when(fleet3.getMilitaryValue()).thenReturn(15); Mockito.when(fleet3.calculateFleetObsoleteValue(info)).thenReturn(1); fleets.add(fleet3); DiplomaticTrade trade = new DiplomaticTrade(map, 0, 1); assertEquals(fleet2, trade.getTradeableFleet(info, fleets)); }
Example #21
Source Project: remote-monitoring-services-java Author: Azure File: MessagesControllerTest.java License: MIT License | 6 votes |
@Test(timeout = 5000) @Category({UnitTest.class}) public void itGetsAllMessages() throws InvalidInputException, InvalidConfigurationException, TimeSeriesParseException { // Arrange IMessages messages = mock(IMessages.class); MessagesController controller = new MessagesController(mock(IMessages.class)); ArrayList<MessageServiceModel> msgs = new ArrayList<MessageServiceModel>() {{ add(new MessageServiceModel()); add(new MessageServiceModel()); }}; MessageListServiceModel res = new MessageListServiceModel(msgs, null); when(messages.getList( DateTime.now(), DateTime.now(), "asc", 0, 100, new String[0])) .thenReturn(res); // Act Result response = controller.list(null, null, null, null, null, null); // Assert assertThat(response.body().isKnownEmpty(), is(false)); }
Example #22
Source Project: azure-storage-android Author: Azure File: CloudQueueTests.java License: Apache License 2.0 | 5 votes |
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testAddMessage() throws StorageException { String msgContent = UUID.randomUUID().toString(); final CloudQueueMessage message = new CloudQueueMessage(msgContent); this.queue.addMessage(message); VerifyAddMessageResult(message, msgContent); CloudQueueMessage msgFromRetrieve1 = this.queue.retrieveMessage(); assertEquals(message.getMessageContentAsString(), msgContent); assertEquals(msgFromRetrieve1.getMessageContentAsString(), msgContent); }
Example #23
Source Project: beam Author: apache File: ValuesTest.java License: Apache License 2.0 | 5 votes |
@Test @Category(NeedsRunner.class) public void testValues() { PCollection<KV<String, Integer>> input = p.apply( Create.of(Arrays.asList(TABLE)) .withCoder(KvCoder.of(StringUtf8Coder.of(), BigEndianIntegerCoder.of()))); PCollection<Integer> output = input.apply(Values.create()); PAssert.that(output).containsInAnyOrder(1, 2, 3, 4, 4); p.run(); }
Example #24
Source Project: Open-Realms-of-Stars Author: tuomount File: BigImagePanelTest.java License: GNU General Public License v2.0 | 5 votes |
@Test @Category(org.openRealmOfStars.BehaviourTest.class) public void testBasic() { Planet planet = new Planet(new Coordinate(5,5), "Test", 1, false); BigImagePanel panel = new BigImagePanel(planet, true, "Planet view"); assertEquals(null, panel.getAnimation()); PlanetAnimation animation = Mockito.mock(PlanetAnimation.class); panel.setAnimation(animation); assertEquals(animation, panel.getAnimation()); PlayerInfo info = Mockito.mock(PlayerInfo.class); panel.setPlayer(info); assertEquals(info, panel.getPlayer()); panel.setText("Test text"); panel.setTitle("Test title"); }
Example #25
Source Project: box-java-sdk Author: box File: EventLogTest.java License: Apache License 2.0 | 5 votes |
@Test @Category(IntegrationTest.class) public void getEnterpriseEventsGmtPlus530() { BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken()); System.setProperty("user.timezone", "Asia/Calcutta"); TimeZone.setDefault(null); Date after = new Date(0L); Date before = new Date(System.currentTimeMillis()); EventLog events = EventLog.getEnterpriseEvents(api, after, before); assertThat(events.getSize(), is(not(0))); assertThat(events.getStartDate(), is(equalTo(after))); assertThat(events.getEndDate(), is(equalTo(before))); }
Example #26
Source Project: mrgeo Author: ngageoint File: HdfsImageResultScannerTest.java License: Apache License 2.0 | 5 votes |
@Test @Category(UnitTest.class) public void testConstructionWithNoZoom() throws Exception { subject = createDefaultSubject(0, bounds); Assert.assertEquals(firstPartitionTileIds[0], subject.currentKey()); }
Example #27
Source Project: Open-Realms-of-Stars Author: tuomount File: LeaderUtilityTest.java License: GNU General Public License v2.0 | 5 votes |
@Test @Category(org.openRealmOfStars.UnitTest.class) public void testNextLeaderAi() { PlayerInfo realm = Mockito.mock(PlayerInfo.class); Mockito.when(realm.getGovernment()).thenReturn(GovernmentType.AI); ArrayList<Leader> pool = new ArrayList<>(); Mockito.when(realm.getLeaderPool()).thenReturn(pool); Leader leader = new Leader("Test Leader"); leader.setAge(18); leader.getPerkList().add(Perk.SLOW_LEARNER); leader.getPerkList().add(Perk.STUPID); pool.add(leader); Leader leader2 = new Leader("Test Leader2"); leader2.setAge(18); leader2.getPerkList().add(Perk.SCIENTIST); leader2.getPerkList().add(Perk.FTL_ENGINEER); leader2.getPerkList().add(Perk.EXPLORER); leader2.getPerkList().add(Perk.CHARISMATIC); leader2.getPerkList().add(Perk.SCANNER_EXPERT); leader2.getPerkList().add(Perk.CORRUPTED); leader2.getPerkList().add(Perk.MICRO_MANAGER); leader2.getPerkList().add(Perk.TRADER); leader2.getPerkList().add(Perk.ACADEMIC); leader2.getPerkList().add(Perk.MILITARISTIC); leader2.getPerkList().add(Perk.WARLORD); pool.add(leader2); Leader ruler = LeaderUtility.getNextRuler(realm); assertEquals(leader2, ruler); }
Example #28
Source Project: beam Author: apache File: TestPipelineTest.java License: Apache License 2.0 | 5 votes |
@Category(NeedsRunner.class) @Test public void testDanglingPTransformNeedsRunner() throws Exception { final PCollection<String> pCollection = pCollection(pipeline); PAssert.that(pCollection).containsInAnyOrder(WHATEVER); pipeline.run().waitUntilFinish(); exception.expect(TestPipeline.AbandonedNodeException.class); exception.expectMessage(P_TRANSFORM); // dangling PTransform addTransform(pCollection); }
Example #29
Source Project: Open-Realms-of-Stars Author: tuomount File: MissionHandlingTest.java License: GNU General Public License v2.0 | 5 votes |
@Test @Category(org.openRealmOfStars.BehaviourTest.class) public void testDeployStarbase2() { PlayerInfo info = Mockito.mock(PlayerInfo.class); Mission mission = new Mission(MissionType.DEPLOY_STARBASE, MissionPhase.LOADING, new Coordinate(5, 5)); MissionList missionList = Mockito.mock(MissionList.class); Mockito.when(missionList.getMissionForFleet(Mockito.anyString())) .thenReturn(null); Mockito.when(info.getMissions()).thenReturn(missionList); Ship starbase = Mockito.mock(Ship.class); Mockito.when(starbase.getTotalMilitaryPower()).thenReturn(20); ShipHull hull = Mockito.mock(ShipHull.class); Mockito.when(hull.getHullType()).thenReturn(ShipHullType.STARBASE); Mockito.when(hull.getName()).thenReturn("Artificial planet"); Mockito.when(starbase.getHull()).thenReturn(hull); Fleet fleet = new Fleet(starbase, 5, 5); FleetList fleetList = new FleetList(); fleetList.add(fleet); Mockito.when(info.getFleets()).thenReturn(fleetList); Game game = Mockito.mock(Game.class); Tile tile = Mockito.mock(Tile.class); Mockito.when(tile.getName()).thenReturn(TileNames.DEEP_SPACE_ANCHOR2); StarMap map = Mockito.mock(StarMap.class); Mockito.when(map.getTile(Mockito.anyInt(), Mockito.anyInt())).thenReturn(tile); Mockito.when(game.getStarMap()).thenReturn(map); MissionHandling.handleDeployStarbase(mission, fleet, info, game); assertEquals(MissionPhase.EXECUTING, mission.getPhase()); }
Example #30
Source Project: beam Author: apache File: SplittableDoFnTest.java License: Apache License 2.0 | 5 votes |
@Test @Category({ ValidatesRunner.class, UsesBoundedSplittableParDo.class, DataflowPortabilityApiUnsupported.class }) public void testOutputAfterCheckpointBounded() { testOutputAfterCheckpoint(IsBounded.BOUNDED); }