@Test
  public void shouldMapReceiveOperationAttibute() throws JMSException {
    // Given
    MappingBuilder myMapping = new MappingBuilder("myop");

    MapMessage message = createPayload("myop", "mappedNoArgCall");

    // When
    MapMessageDecoder.of(MappedApi.class, serviceMock, myMapping.build()).onMessage(message);

    // Then
    verify(serviceMock).mappedNoArgCall();
  }
Ejemplo n.º 2
0
  public ImmutableTypesWrapper(AnnotationWrapper mapper, MapperGeneratorContext context) {
    this.mapper = mapper;
    this.context = context;
    this.immutables = new HashMap<InOutType, MappingBuilder>();
    this.unusedImmutables = new HashSet<InOutType>();

    List<String> immutables = mapper.getAsStrings("withImmutables");
    for (String immutableClass : immutables) {
      final TypeElement element =
          context.elements.getTypeElement(immutableClass.replace(".class", ""));

      InOutType ioType = new InOutType(element.asType(), element.asType(), false);
      this.immutables.put(ioType, MappingBuilder.newImmutable());
      this.immutables.put(new InOutType(ioType, true), MappingBuilder.newImmutable());
      this.unusedImmutables.add(ioType);
    }
  }
  @Test
  @Ignore
  // TODO reenable
  public void shouldMapReceiveBoxedPrimitiveAttributesIfWrittenAsStrings(
      /* @Values("BOXED_PRIMITIVE_CALLS") */ SimpleServiceCall call) throws Exception {
    // Given
    MappingBuilder mapping = new MappingBuilder(OPERATION_FIELD_NAME);
    String operation = call.operation;
    String argument = call.argument;
    Class<?> type = call.type;
    Object value = call.value;
    mapping.mapField(argument, FieldMapping.map(argument));

    MapMessage message =
        createPayload(OPERATION_FIELD_NAME, operation, argument, String.valueOf(value));

    // When
    MapMessageDecoder.of(BoxedPrimitivesTestApi.class, boxedPrimitivesServiceMock, mapping.build())
        .onMessage(message);

    // Then
    invoke(verify(boxedPrimitivesServiceMock), operation, type, value);
  }