当前位置: 首页>>代码示例>>Java>>正文


Java Representation.getLinkByRel方法代码示例

本文整理汇总了Java中com.theoryinpractise.halbuilder.api.Representation.getLinkByRel方法的典型用法代码示例。如果您正苦于以下问题:Java Representation.getLinkByRel方法的具体用法?Java Representation.getLinkByRel怎么用?Java Representation.getLinkByRel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.theoryinpractise.halbuilder.api.Representation的用法示例。


在下文中一共展示了Representation.getLinkByRel方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSlotRepresentationWithNextAndPrevLinks

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testSlotRepresentationWithNextAndPrevLinks()
    throws JsonProcessingException {
Slot thisSlot = newSlotStub(2);
Slot prevSlot = newSlotStub(1);
Slot nextSlot = newSlotStub(3);

Representation rep = factory.newSlotRepresentation(thisSlot,
	Optional.of(prevSlot), Optional.of(nextSlot));

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("prev");
assertEquals(slotUriBuilder.build(prevSlot.getId()).toString(),
	link.getHref());

link = rep.getLinkByRel("next");
assertEquals(slotUriBuilder.build(nextSlot.getId()).toString(),
	link.getHref());

String doctorId = rep.getValue("doctorId", "").toString();
assertEquals(thisSlot.getDoctorId(), doctorId);
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:25,代码来源:AvailabilityRepresentationFactoryTest.java

示例2: testSlotRepresentationWithPrevLink

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testSlotRepresentationWithPrevLink()
    throws JsonProcessingException {
Slot thisSlot = newSlotStub(2);
Slot prevSlot = newSlotStub(1);

Representation rep = factory.newSlotRepresentation(thisSlot,
	Optional.of(prevSlot), Optional.<Slot> empty());

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("prev");
assertEquals(slotUriBuilder.build(prevSlot.getId()).toString(),
	link.getHref());

link = rep.getLinkByRel("next");
assertNull(link);

String doctorId = rep.getValue("doctorId", "").toString();
assertEquals(thisSlot.getDoctorId(), doctorId);
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:23,代码来源:AvailabilityRepresentationFactoryTest.java

示例3: testSlotRepresentationWithNextLink

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testSlotRepresentationWithNextLink()
    throws JsonProcessingException {
Slot thisSlot = newSlotStub(1);
Slot nextSlot = newSlotStub(2);

Representation rep = factory.newSlotRepresentation(thisSlot,
	Optional.<Slot> empty(), Optional.of(nextSlot));

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("next");
assertEquals(slotUriBuilder.build(nextSlot.getId()).toString(),
	link.getHref());

link = rep.getLinkByRel("prev");
assertNull(link);

String doctorId = rep.getValue("doctorId", "").toString();
assertEquals(thisSlot.getDoctorId(), doctorId);
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:23,代码来源:AvailabilityRepresentationFactoryTest.java

示例4: testSlotsRepresentation

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testSlotsRepresentation() {
List<Slot> slots = newSlotsStub();
Representation rep = factory.newSlotsRepresentation(slots);

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("self");

assertEquals(slotsUriBuilder.build().toString(), link.getHref());

link = rep.getLinkByRel("item");
String href = link.getHref();

assertTrue(slots.stream().anyMatch(
	slot -> href.endsWith(String.valueOf(slot.getId()))));

link = rep.getLinkByRel("start");
assertEquals(slotUriBuilder.build(slots.get(0).getId()).toString(),
	link.getHref());
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:23,代码来源:AvailabilityRepresentationFactoryTest.java

示例5: testApptRepresentationWithSelfLink

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testApptRepresentationWithSelfLink() {
Appointment appt = newApptStub(1);

Representation rep = factory.newAppointmentRepresentation(appt);

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("self");
assertEquals(apptUriBuilder.build(appt.getId()).toString(),
	link.getHref());
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:14,代码来源:AppointmentRepresentationFactoryTest.java

示例6: testSlotRepresentationWithEditLinks

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testSlotRepresentationWithEditLinks() {
Appointment appt = newApptStub(1);

Representation rep = factory.newAppointmentRepresentation(appt);

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("edit");
assertEquals(apptUriBuilder.build(appt.getId()).toString(),
	link.getHref());
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:14,代码来源:AppointmentRepresentationFactoryTest.java

示例7: testSlotRepresentationWithSelfLink

import com.theoryinpractise.halbuilder.api.Representation; //导入方法依赖的package包/类
@Test
   public void testSlotRepresentationWithSelfLink() {
Slot thisSlot = newSlotStub(2);

Representation rep = factory.newSlotRepresentation(thisSlot,
	Optional.<Slot> empty(), Optional.<Slot> empty());

System.out.println(rep
	.toString(HAL_JSON, PRETTY_PRINT, COALESCE_ARRAYS));

Link link = rep.getLinkByRel("self");
assertEquals(slotUriBuilder.build(thisSlot.getId()).toString(),
	link.getHref());
   }
 
开发者ID:asarkar,项目名称:java-ee,代码行数:15,代码来源:AvailabilityRepresentationFactoryTest.java


注:本文中的com.theoryinpractise.halbuilder.api.Representation.getLinkByRel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。